simple html dom failed to open stream

Hi i have a issue in simple html dom code it show this error :-

file_get_contents(http://www.arakne-links.com) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampp\htdocs\scrap\simple_html_dom.php on line 75

because this url http://www.arakne-links.c is not working now i want

to know is there any way to skip the url which is not working..

here is the code which i am using

ini_set('display_errors', 'on'); 
include_once('../../simple_html_dom.php');

// create HTML DOM

$htmls =  file_get_html('http://info.vilesilencer.com/top');    
foreach($htmls->find('a[rel="nofollow"]') as $e):
$test = $e->href;
$url  = array( $test );
$html = array();
foreach( $url as $key=>$value ) { 

// get html plain-text for webpage & assign to html array.

$html = file_get_html( trim($value) ); 

// echo html plain text:
echo $html->find('title', 0)->innertext;

}     
endforeach; 

Please Help me to fix this issue.

Thankyou

Answers


How about checking the URL before parsing?

ini_set('display_errors', 'on'); 
include_once('simple_html_dom.php');

function urlOk($url) {
    $headers = @get_headers($url);
    if($headers[0] == 'HTTP/1.1 200 OK') return true;
    else return false;
}

// create HTML DOM

$htmls =  file_get_html('http://info.vilesilencer.com/top');    
foreach($htmls->find('a[rel="nofollow"]') as $e):
    $test = $e->href;
    $url  = array( $test );
    $html = array();
    foreach( $url as $key=>$value ) { 
       // get html plain-text for webpage & assign to html array.
       if (urlOk(trim($value))) {
           $html = file_get_html( trim($value) ); 
           echo $html->find('title', 0)->innertext;
           echo "<br />";
       } else {
         echo 'Error: URL '.$value.' doesn\'t exist.<br />';
       }
}     
endforeach; 
?>

Need Your Help

Can't get the value from other textfield except the first one

php

I use the code from phpwebcommerce's shopping cart tutorial, and I am trying to add a text field for user to insert quantity. Since there are different number of choices for a single product, so I ...

XSL to return XML of sharepoint 2010 list webpart

xslt sharepoint-2010

I have a regular tasks list and I have to customize the way i display it sharepoint 2010.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.