我尝试使用Google php OAuth2(google-api-php-client),我有curl errno 35,但只有当我使用代理时:
HTTP Error: (0) Unknown SSL protocol error in connection to accounts.google.com:8080
我测试了很多解决方案:
// Test disabled verify peer & host
CURLOPT_SSL_VERIFYPEER => false
CURLOPT_SSL_VERIFYHOST => false
...
// Test set proxy & auth proxy
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYPORT, '8080');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
...
// Test set auth proxy in header
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization' => $proxyauth))
...
// Test Specify the SSL version
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
...
// Test specify HTTP version
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
...
// Test change proxy type
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
or
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
我尝试了各处找到的不同解决方案(上面几乎详尽的清单),但没有一个适用于我。
我想知道这不是问题的端口号,但是我没有成功改变这个(我尝试使用CURLOPT_PORT选项),还有Google_OAuth2.php中的URL。
感谢您的帮助,
西蒙。
答案 0 :(得分:1)
我正在解决这个问题。还没有解决方案,但这是我发现的:
如果比较输出:
$ curl -v https://accounts.google.com
* About to connect() to proxy 10.1.1.10 port 8080 (#0)
* Trying 10.1.1.10... connected
* Connected to 10.1.1.10 (10.1.1.10) port 8080 (#0)
* Establish HTTP proxy tunnel to accounts.google.com:443
> CONNECT accounts.google.com:443 HTTP/1.1
> Host: accounts.google.com:443
> User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.21.7 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.2.7
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
...
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=accounts.google.com
...
* SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.21.7 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.2.7
> Host: accounts.google.com
> Accept: */*
(有效)和
$ curl -v https://accounts.google.com:8080
你会发现问题是
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
我猜代理服务器正在将端口附加到返回地址,这就是导致证书验证失败的原因。不幸的是,代理服务器不是我的专业领域。希望这能为您提供线索。