php script to check for down ads? then change them...

Discussion in 'PHP' started by supraturbo, Dec 4, 2007.

  1. #1
    I'm looking for a script that would be able to do a check to see if the ads are showing or if they are returning a 404 error / down without a ping. Anyone have any ideas? I was more or less looking for something that could tell if auctionads was down and if they were it would switch the ads to something else untill they returned back online.
     
    supraturbo, Dec 4, 2007 IP
  2. vonvhen

    vonvhen Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    interesting ideas...

    hmm... maybe do a fopen on the url ? if it is down, display different ads.
     
    vonvhen, Dec 4, 2007 IP
  3. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    An fopen will still return a value if a 404 is thrown and if their page is customized it can be hard to tell if it is actually a 404. You really need to check the http response headers and determine if a '404 Not Found' was sent.

    CURL will enable you to accomplish this. You can send a CURL GET Request to the server and then analyze the HTTP response and see if you can find '404 Not Found'.

    This page should get you started: http://wiki.ittoolbox.com/index.php/Use_curl_from_PHP:_processing_response_headers
     
    tonybogs, Dec 4, 2007 IP
  4. danzor

    danzor Peon

    Messages:
    208
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    http://uk2.php.net/get_headers

    Array
    (
    [0] => HTTP/1.1 200 OK
    [1] => Date: Sat, 29 May 2004 12:28:13 GMT
    [2] => Server: Apache/1.3.27 (Unix) (Red-Hat/Linux)
    [3] => Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
    [4] => ETag: "3f80f-1b6-3e1cb03b"
    [5] => Accept-Ranges: bytes
    [6] => Content-Length: 438
    [7] => Connection: close
    [8] => Content-Type: text/html
    )
     
    danzor, Dec 4, 2007 IP
  5. supraturbo

    supraturbo Active Member

    Messages:
    57
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    63
    #5
    ok cool thanks for the help
     
    supraturbo, Dec 5, 2007 IP