PHP Curl access to HTTPS domain interface has been an error problem

Source: Internet
Author: User
Tags http 200 ssl certificate

have been docking an HTTPS interface for the last two days

After the perfect link with the local postman server has been error

Problem: Linux under Curl can be accessed normally but PHP requests always return FALSE

Test method: Var_dump (Curl_error ($ch)); < before close >

return: "ssl:certificate subject name ' xxx ' does not match target host name ' www.miniscores.cn '"

This indicates that the SSL certificate is problematic if the other party does not have a given certificate. Just ignore it.

Workaround:

1, ignore the certificate (two must add!) Otherwise, it cannot be ignored):

curl_setopt ($ch, Curlopt_ssl_verifypeer, false);

curl_setopt ($ch, Curlopt_ssl_verifyhost, false);

2, nature is to let each other provide certificates

Another solution to the problem of turning the great God (taoismess):

using Curl in the command line to invoke the method of skipping SSL certificate checking, the friend you need can refer to below. Symptom: Php Curl calls HTTPS error troubleshooting method: 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. Troubleshooting methods: Var_dump (Curl_error ($ch)); Returns: string (Reply) "Empty from server" and then troubleshoot: curl_setopt ($ch, Curlopt_header, true); curl_setopt ($ch, Curlopt_returntransfer, false); return: http/1.1 Continue connection:close Reason: Php Curl received HTTP 100 ended, should continue to receive HTTP 200 solution: curl_setopt ($ch, curlopt_httph Eader, Array (' Expect: '));

PHP Curl access to HTTPS domain interface has been an error problem

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.