Forum Moderators: coopster

Message Too Old, No Replies

HTTP header information

         

turbohost

1:05 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



Hi Guys,

I'm looking for some kind of function to get the http header information from a site. Let's say I open a specific url from inside a php script and I want to receive a 404 if the site is unavailable and a 200 if the site is available. Somebody knows if this is possible?

Turbo

lobo235

1:49 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



If you use curl library [php.net] to fetch the page then you are able to see the HTTP status code using curl_getinfo() [php.net]. Also, you could manually create the page request using fsockopen() [php.net] and read the http header that comes back for your request. I prefer using the curl library though because it makes the job a lot easier.