Default PHP - how to get headers of an HTTPS page?

datrader

New member
Apr 10, 2011
22
0
0
hi,

i'd like to check the server headers (200/404/502) of an HTTPS page.

how do i do that in PHP?

the function get-headers doesn't support HTTPS.


thanks guys!
 


Google? You ever hear of it? Use cURL:

Code:
$ch = curl_init('http://yoururl/');
curl_setopt($ch, CURLOPT_HEADER, 1);
$c = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE);

This will return the status code only, 200, 404, etc...

If you want the entire header see here:
Header only retrieval in php via curl - Stack Overflow
 
thanks bro. Curl was the answer (i'm not familiar with it).

thanks for the help!

man i love this forum, all the pros in one place!