我需要使用简单的 html dom 抓取一个大的 html 文件(例如:http://www.indianrail.gov.in/mail_express_trn_list.html)。我从一个简单的脚本开始:
<?php
require "simple_html_dom.php";
echo file_get_html('http://www.indianrail.gov.in/mail_express_trn_list.html')->plaintext;
?>
什么都不显示,只有一个空白页面,Apache error.log 文件中有错误消息
PHP Notice: Trying to get property of non-object in /var/www/index.php on line 3
PHP Notice: Trying to get property of non-object in /var/www/index.php on line 3
同时所有其他页面(例如:http://www.indianrail.gov.in/special_trn_list.html)都可以使用相同的脚本正常工作。
最佳答案
问题似乎是 simple_html_dom
中定义的 MAX_FILE_SIZE
。
您可以通过编辑 simple_html_dom.php 文件中的 define('MAX_FILE_SIZE', 600000);
行来调整它。
关于php - 简单的 html dom 抓取大型 html 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17939101/