getaddrinfo failed

Discussion in 'PHP' started by varunkrish, Nov 30, 2005.

  1. #1
    i am working on a script which needs to have a link back to our site.

    Some people are removing the link to the script in the skin of our script

    We have the following information with us in our database

    client_name
    client_url
    client_status

    i run a foreach loop after fetching data from the table
    open the url using fopen and check for occurence of a link to "http://www.domain.com"

    $urlContents = file($client_url);
    for ($i=0; $i<count($urlContents ); $i++) {
    $text = $text . $urlContents [$i];
    }
    if (eregi($client_url, $text)) {
    true
    }
    else {
    false
    }

    this part is working

    i need to check for 404 errors on invalid domains

    if i run this script when a domain is down i get this error

    Warning: file() [function.file]: php_network_getaddresses: getaddrinfo failed: No such host is known. in validate.php on line 24

    line 24 is $urlContents = file($client_url);

    any way to handle this error
     
    varunkrish, Nov 30, 2005 IP
  2. mika

    mika Active Member

    Messages:
    136
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    How do you exactly want to handle it? If the host is down you can't do anything...
     
    mika, Dec 2, 2005 IP
  3. varunkrish

    varunkrish Peon

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i figured it out

    use @file to suppress the error message. :p
     
    varunkrish, Dec 2, 2005 IP