curl错误35:未知SSL谷歌OAuth2


curl error 35 : Unknown SSL google OAuth2

我尝试使用Google php OAuth2(Google api php客户端),并且我有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中更改它

谢谢你的帮助,

西蒙。

我正在处理这个确切的问题。还没有解决方案,但以下是我发现的:

如果比较的输出

$ 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

我猜代理服务器正在将端口附加到返回地址,这就是导致证书验证失败的原因。不幸的是,代理服务器不是我的专业领域。希望这能给你一个线索。