Reputation: 1
We are Unable to make https requests via proxy using php and curl. We tried to make a simple curl request from PHP to https://google.com and we get message 'Request could not be processed.Invalid response received by proxy or gateway server'.The same request to http:/google.com works fine. We are also able to successfully call any https url from curl command line. below is our curl request. Proxy doesn't require login and we have openssl installed in PHP. Any replies are appreciated.
$url='https://google.com';
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_PROXY, 'some proxy');
curl_setopt($handle, CURLOPT_PROXYPORT, 80);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_VERBOSE, TRUE);
$data = curl_exec($handle);
Upvotes: 0
Views: 3944
Reputation: 6145
Try changing:
curl_setopt($handle, CURLOPT_PROXYPORT, 80);
to:
curl_setopt($handle, CURLOPT_PROXYPORT, 443);
Since https traffic is on port 443.
Upvotes: 0