我们无法通过代理使用php和curl进行https请求。我们试图从PHP到https://google.com发出一个简单的curl请求,并且我们收到消息'请求无法处理。代理或网关服务器收到的无效响应'。对http:/google.com的相同请求正常工作。我们也能够从curl命令行成功调用任何https网址。下面是我们的卷毛请求。代理不需要登录,我们已经在PHP中安装了openssl。任何答复表示赞赏。无法通过代理使用,PHP和卷曲进行https请求
$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);
您的代理服务器是否需要凭据? –
不需要任何凭证。 – user1470056
好的,那你应该把'CURLOPT_FOLLOWLOCATION'设置为'true'。 –