curl

Example: (Send a post request with specific header):

 

Error Handling

顯示錯誤: curl_error($ch)

SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

如果出現上面這個問題:

Solution 1:
CURLOPT_SSL_VERIFYPEER => false
http://blog.kejyun.com/2012/12/Facebook-PHP-SDK-SSL-Certificate-Problem-Solution.html

 

Solution 2: 表示Cert有問題,請參考:
http://davidwalsh.name/php-ssl-curl-error 
http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/ 

總之要加上下面這個參數:
curl_setopt($ch,CURLOPT_CAINFO,’d:\path\cert.pem’);
cert.pem下載網址: http://curl.haxx.se/docs/caextract.html

 

Reference:

  1. http://www.inote.tw/2009/04/php-curl.html

One thought on “curl

  1. christine

    hello there and thank you for your information – I have definitely picked up anything new from right here.
    I did however expertise a few technical issues using this site, as I experienced to reload
    the web site a lot of times previous to I could get it to load correctly.
    I had been wondering if your web host is OK?
    Not that I’m complaining, but sluggish loading instances times will often affect your placement in google and can damage your high quality score if advertising and marketing with Adwords. Well I’m adding this RSS to my email and can look out
    for a lot more of your respective fascinating content.
    Ensure that you update this again soon.

Comments are closed.