I'm trying to make a Curl request in php. I started by doing it via the command line this way : curl -k -X "POST" -d "{\\"_format\\":\\"json\\",\\"id\\":\\"152\\",\\"subscription_type\\":\\"TEST\\"}" -H "Content-type:\\ application/json" -H "Accept:\\ application/json" https://url
Now I need to make it in PHP , but i don't know what is the equivalent of the -k (to turn off the certificate verification) option in PHP .
But I've tried something :
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => false
));
curl's -k
option actually sets two different options to false. It disables the check of the signature in the cert , and it disables the check of the host name in the cert :
CURLOPT_SSL_VERIFYPEER => false
CURLOPT_SSL_VERIFYHOST => false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.