PHP Curl Common error: SSL error, Boolfalse

Source: Internet
Author: User
Tags http 200 ssl certificate
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 ended, should continue to receive HTTP 200
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.

The above describes the PHP Curl common error: SSL error, Boolfalse, including aspects of the content, want to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.