我寻觅了网,发现用简单的HTML DOM提取数据的方式,但它给我下面的错误中提取从网页上的价值:使用简单的HTML DOM
Warning: file_get_contents(http://www.flipkart.com/moto-g-2nd-gen/p/itme6g3wferghmv3): failed to open stream: HTTP request failed! HTTP/1.1 500 Server Error in C:\Users\Abhishek\Desktop\editor\request\simple_html_dom.php on line 75
Fatal error: Call to a member function find() on boolean in C:\Users\Abhishek\Desktop\editor\request\main.php on line 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>';
?>
我在这个编程中有一个新东西,但没有足够的知识,但在我的程序中是否有任何错误?
还是不退货的。 –
我已经更新了我的答案,如果它对您有帮助,请考虑投票1+,并通过点击投票箭头中间的复选标记tks接受它作为正确答案! –
是的,它工作..上次我在URL中犯了一个错误.. –