【发布时间】:2015-05-11 17:56:35
【问题描述】:
我在网上搜索并找到了使用简单 html dom 提取数据的方法,但它给了我以下错误:
警告: 文件获取内容(http://www.flipkart.com/moto-g-2nd-gen/p/itme6g3wferghmv3): 无法打开流:HTTP 请求失败! HTTP/1.1 500 服务器错误 在 C:\Users\Abhishek\Desktop\editor\request\simple_html_dom.php 上 第 75 行
致命错误:在布尔值中调用成员函数 find() C:\Users\Abhishek\Desktop\editor\request\main.php 在第 9 行
我为它设计的php代码是:
<?php
include('simple_html_dom.php');
$html = file_get_html('http://www.flipkart.com/moto-g-2nd-gen/p/itme6g3wferghmv3');
foreach($html->find('span.selling-price.omniture-field') as $e)
echo $e->outertext . '<br>';
?>
我是这个编程的新手,没有足够的知识,但我的程序有什么错误吗?
【问题讨论】:
标签: php html web-scraping file-get-contents