Tag Archives: curl

cURL via SSL return http_code 0 (WAMP)

I was having some trouble on a WAMP installation when trying to cURL an encrypted site over port 443. The cURL response was not helpful at all, it was as follows: [url] => https://encrypted.google.com/ [content_type] => text/plain;charset=utf-8 [http_code] => 200 [header_size] => 229 [request_size] => 170 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.027 [namelookup_time] => 0 [connect_time] => 0.002 [pretransfer_time] => 0.004 [size_upload] => 0 [size_download] => 227 [speed_download] => 8407 [speed_upload] => 0 [download_content_length] => 227 [upload_content_length] => 0 [starttransfer_time] => 0.027 [redirect_time] => 0 After quite a bit of researching, I found that the problem was related to checking the certificate. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); The aforementioned fix works, but it is sort of quick-and-dirty. If you’d like to know the proper way to fix this, you’d need to use the CURLOPT_CAINFO option. See this post for details.

Posted in Web Development | Tagged , , | Leave a comment