【发布时间】:2013-04-27 19:31:10
【问题描述】:
您好,我在简单的 html dom 代码中遇到问题,它显示此错误:-
file_get_contents(http://www.arakne-links.com) [function.file-get-contents]:无法打开流: php_network_getaddresses:getaddrinfo 失败:不知道这样的主机。 在 D:\xampp\htdocs\scrap\simple_html_dom.php 第 75 行
因为这个网址 http://www.arakne-links.c 现在我想要的不起作用
要知道有什么方法可以跳过不起作用的 url..
这是我正在使用的代码
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;
请帮我解决这个问题。
谢谢你
【问题讨论】:
-
你在哪里使用
file_get_content函数。 -
我修复它并进入下一个 url 但现在有新错误我替换此代码 $html = file_get_html( trim($value) ); // echo html 纯文本: echo $html->find('title', 0)->innertext;与 $html = @file_get_html( 修剪($value) ); if($html){ echo $html->find('title', 0)->innertext; }else{ //错误回显'不工作'; } 但现在它显示了一些通知
-
你好小姐便便我在这里使用 file_get_content echo $html->find('title', 0)->innertext;它是一个 simple_html_dom.php 函数
-
它显示了什么通知?
标签: php error-handling simple-html-dom