hi can anyone give me a link on tutorials to determine if site is up or down, if it's http or https. thanks.
determining if site is up or down
get_headers() check for 200, 302 etc
thanks for the get headers part but how do u determine if a site is up or down? I have this project which monitors alot of sites,domains, if they are down then the system will automatically email the admin that the certain site is down
Well, if you get 200 (ok) then the site is up. Depending on the error you get, you can derive whether it's working. 302 is found, 404 is not found, etc.
http://us.php.net/get_headers
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
so correct me if i'm wrong but the flow is like this :
- get_headers();
- if it returns 404 then that site,server,domain,access point is down
-else its up?
wow never knew it was that simple, sorry if I had to ask instead of trying first,i just want to make sure, I just crashed our server the other day with some mistakes i commited dont want to get fired eheheh thanks.
aw sorry my bad didnt see the link
If get_headers() returns a 404 response, then the site is "up", but the URL you requested couldn't be found.
If get_headers() returns boolean FALSE, then the server itself is down.