How does CURL obtain the HTTPS status code?
$curl = curl_init();$url='https://';curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl,CURLOPT_NOBODY,true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); echo curl_getinfo($curl,CURLINFO_HTTP_CODE); curl_close($curl);
I can print the http status code in this way, but I have always output 0 for https. how can I obtain the https status code?
Reply to discussion (solution)
Https? Please? Add
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false); // skip certificate check
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false); // check whether the SSL encryption algorithm exists from the certificate
'Fdipregion'); $ header = array (); list ($ code, $ response) = curl_https ($ url, $ data, $ header, 5); echo $ code; echo $ response;?>