虽然包括简单的HTML DOM库,我得到的警告:简单的HTML DOM库
警告:file_get_contents()函数[function.file-GET-内容]:php_network_getaddresses:的getaddrinfo失败:没有这样的主机是已知的。在线70上的C:\ xampp \ htdocs \ simple_html_dom.php
警告:file_get_contents(http://www.google.com/)[function.file-get-contents]:无法打开流:php_network_getaddresses: getaddrinfo失败:没有这样的主机是已知的。在C:\ XAMPP \ htdocs中\ simple_html_dom.php上线70
在simple_html_dom.php文件(从http://sourceforge.net/projects/simplehtmldom/files/latest/download下载)的线70是
$contents = file_get_contents($url, $use_include_path, $context, $offset);
另外1错误:
致命错误:调用一个成员函数查找()在C语言的非对象:\ XAMPP \ htdocs中\ domdoc2.php第15行
在码(下图)的线15是
foreach($html->find('img') as $element)
的网页我在我下面的代码指是google.com 代码如下:
<?php
include('simple_html_dom.php');
$html = new simple_html_dom();
$html = file_get_html('http://www.google.com/');
// Find all images
foreach($html->find('img') as $element)
echo $element->src . '<br>';
// Find all links
foreach($html->find('a') as $element)
echo $element->href . '<br>';
?>
我在做什么错?
这不是一个图书馆的问题,PHP只是无法解析主机到一个IP地址 –
该文件执行那里? –
@Baszz你指的是哪个文件? DOM文件在那里,它也包含在内 – saur