Home > Article > Backend Development > How to use curl to get https request in php_PHP tutorial
This article mainly introduces the method of using curl to obtain https requests in PHP. It involves the operation skills of curl for https requests, which is very practical. Value, friends in need can refer to it
The example in this article describes how PHP uses curl to obtain https requests. Share it with everyone for your reference. The specific analysis is as follows:
I am working on a project today and need to use curl to obtain a third-party API. The other party’s API is https.
I was able to obtain http requests using curl before, but when I obtained https requests today, the following error message appeared: Certificate verification failed.
SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
The solution is to add:
during curl requestThe code is as follows:
curl https request code
The code is as follows:
I hope this article will be helpful to everyone’s PHP programming design.