error handling - PHP - failed to open stream: no such host is known -


hi have issue in simple html dom code show error :-

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

because url http://www.arakne-links.c not working want

to know there way skip url not working..

here code 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"]') $e): $test = $e->href; $url  = array( $test ); $html = array(); foreach( $url $key=>$value ) {   // html plain-text webpage & assign html array.  $html = file_get_html( trim($value) );   // echo html plain text: echo $html->find('title', 0)->innertext;  }      endforeach;  

please me fix issue.

thankyou

how checking 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"]') $e):     $test = $e->href;     $url  = array( $test );     $html = array();     foreach( $url $key=>$value ) {         // html plain-text webpage & assign 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;  ?> 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -