我正在只有PHP4的服務器上編寫站點。我正在嘗試解析我學校的網站以獲取課程會議時間和地點(this website)。不,我無法讓管理員安裝PHP5。這是我的代碼,返回一個錯誤:如何使用PHP4解析HTML
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');
// Find all images
foreach($html->find('img') as $element)
echo $element->src . '<br>';
JavaScript是這種類型的任務的選項?
檢查此問題:http://stackoverflow.com/questions/3503276/porting-php5-to-legacy-php4-domdocument-quibbles – Brad 2012-08-04 01:18:39
可能是[php4-html-dom](http:///php4-html-dom.sourceforge.net/documentation/php4-html-dom/htmlParser.html)? – elias 2012-08-04 01:20:40
@brad謝謝,但我是新的PHP解析。也許你可以寫一個關於如何在php4服務器上使用php5代碼的答案 – user176105 2012-08-04 01:21:57