0
我試圖獲取TNT包裹的最新狀態(在本例中爲「良好態度的貨件」),但無法使用簡單的html dom解析外部html 。獲得致命錯誤:調用一個成員函數查找()一個非對象在第6行使用簡單的html dom解析外部html獲取致命錯誤
<?php
include("simple_html_dom.php");
$html = file_get_html('http://www.tnt.com/webtracker/tracking.do?&cons=323626321');
$e=$html->find('table.appTable', 1)->find('tr[valign=top]', 0)->find('td', 3);
echo $e;
?>
甚至從http://simplehtmldom.sourceforge.net/index.htm示例代碼給了我同樣的錯誤
<?php
$html = file_get_html('http://www.google.com/');
foreach($html->find('img') as $element)
echo $element->src . '<br>';
?>
我是什麼做錯了?
http://stackoverflow.com/questions/7124823/file-get-html-displays-fatal-error –
你的服務器上是否封鎖了file_get_contents?任何方式請爲我們發佈var_dump($ html) –
@SholehFalahati獲取「bool(false)」 阻止的「file_get_contents」與「file_get_html」有什麼關係?我必須修改某些內容才能使其正常工作嗎? – vincchan