我正在尝试使用curl连接到网站。在我的本地机器上我可以连接,但在开发服务器上它不起作用。
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_TIMEOUT, 3 );
curl_setopt( $ch, CURLOPT_VERBOSE, true );
curl_setopt( $ch, CURLOPT_USE_SSL, true );
curl_setopt( $ch, CURLOPT_FRESH_CONNECT, true );
在我的本地计算机上,curl配置为使用OpenSSL,并且在开发计算机上curl正在使用NSS。
这是我在开发机器
上获得的输出 * About to connect() to www.zomato.com port 443 (#0)
* Trying 104.81.108.141...
* Connected to www.zomato.com (104.81.108.141) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=*.zomato.com,OU=Engineering,O=Zomato Media Private Limited,L=New Delhi,ST=Delhi,C=IN
* start date: May 04 00:00:00 2017 GMT
* expire date: Aug 03 23:59:59 2018 GMT
* common name: *.zomato.com
* issuer: CN=GeoTrust SSL CA - G3,O=GeoTrust Inc.,C=US
> GET /sk/slovakia HTTP/1.1
Host: www.zomato.com
Accept-Language: en,ro;q=0.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept-Encoding: gzip, deflate, br
* Operation timed out after 3000 milliseconds with 0 out of -1 bytes received
* Closing connection 0
这是我在本地计算机
上获得的输出 * Trying 104.84.165.29...
* TCP_NODELAY set
* Connected to www.zomato.com (104.84.165.29) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: G:\cacert.pem
CApath: none
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=IN; ST=Delhi; L=New Delhi; O=Zomato Media Private Limited; OU=Engineering; CN=*.zomato.com
* start date: May 4 00:00:00 2017 GMT
* expire date: Aug 3 23:59:59 2018 GMT
* subjectAltName: host "www.zomato.com" matched cert's "*.zomato.com"
* issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust SSL CA - G3
* SSL certificate verify ok.
> GET /sk/slovakia HTTP/1.1
Host: www.zomato.com
Accept-Language: en,ro;q=0.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept-Encoding: gzip, deflate, br
< HTTP/1.1 200 OK