Symptom: Php Curl calls HTTPS error
Troubleshooting: Try using Curl on the command line.
Cause: The server's computer room cannot verify the SSL certificate.
Workaround: Skip the SSL certificate check.
curl_setopt ($ch, Curlopt_ssl_verifypeer, false);
Symptom: Php Curl call Curl_exec returns BOOL (false), command line curl is called normally.
How to troubleshoot:
Var_dump (Curl_error ($ch));
return:
string (Reply) "Empty from server"
Further troubleshooting:
curl_setopt ($ch, Curlopt_header, true);
curl_setopt ($ch, Curlopt_returntransfer, false);
return:
http/1.1 Continue
Connection:close
Cause: Php Curl received HTTP 100 is ended, should continue to receive HTTP
Solution:
curl_setopt ($ch, Curlopt_httpheader, Array (' Expect: '));
PHP and curl:disabling 100-continue header
Published June 15th, 2006
I ' ve been using CURL (through PHP) to build a sort of proxy for a project I ' m working on. I need to parse the returned headers (to recover the HTTP status), so had included a very simple script to do. It had worked fine in the past, but is some reason barfed in this case. A closer look at what is being returned revealed that for some reason, Apache is prepending the ' normal ' headers with an Extra response Header:
http/1.1 Continue
http/1.1 OK Date:fri, June 2006 15:23:42 GMT
Server:apache
... A bit of googling revealed that this is to does with a header that is CURL sends by default:
expect:100-continue
... which in turns tells Apache to send the extra header. I poked around a fair bit but couldn ' t quite find a workable solution short of manually removing the header in PHP, which Seemed a bit clumsy. Finally, on a hunch I tried this:
curl_setopt ($curl _handle, Curlopt_httpheader, Array (' Expect: '));
... which basically overrides the original ' Expect: ' header with an empty one.
Hope This helps someone.