View Full Version : receiving error codes back from header()

02-14-2006, 06:22 PM
I need to write a script that goes out periodically and checks to see if a website is up and running. I was going to use

header(location: http://www.example.com) ;

is there a way to find out if the function completed successfully?


02-14-2006, 06:32 PM
No and you have a syntax error.
You would probably want to use:
then read the headers it gives you back although that can lead to ambiguous results if the url you link to is redirecting (which you would have to then follow).
using curl may also be good for this (whether through php or via the actual curl binary).

02-14-2006, 06:41 PM
thanks, I will check out curl and fsockopen, have since thought about just using a simple ping and see if comes back or not. sorry about the syntax, I realized I had forgotten my "s after I closed code and was just too lazy to go back.