我尋覓了網,發現用簡單的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中犯了一個錯誤.. –