/ Published in: PHP
This returns the headers from an HTTP request. I'm sure there's a better way to do this without resorting to output buffering, but it works.
Expand |
Embed | Plain Text
function getheader($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); $ok = curl_exec($ch); curl_close($ch); return $head; }
Comments
Subscribe to comments
You need to login to post a comment.

PHP5 has this function built-in, however it's nice to have this laying around if you're forced to use PHP4.