Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts

    receiving error codes back from header()

    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
    Code:
    header(location: http://www.example.com) ;
    is there a way to find out if the function completed successfully?

    thanks.

  • #2
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No and you have a syntax error.
    You would probably want to use:
    http://us3.php.net/fsockopen
    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).

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •