0

Is there a way to gather the HTTP header send from a server so that I can check if it is a code 200 or a code 404 and base the output from that.

Thanks for the help

EmcLinux

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by emclinux
0

if you use straightforwad php :
get_headers()

I like cUrl better
after executing,
you can retrieve the headers from the instance with curl_getinfo()
...

$curl_info = curl_getinfo($ch);
foreach($curl_info as $key=>$value) {
echo $key .'='. $value.'<br />';
}

...
or

$curl_info = curl_getinfo($ch);
echo $curl_info['http_code'];
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.