File_get_html在PHP Simple HTML DOM Parser中返回空的html

Ton*_*niD 1 php user-agent simple-html-dom

我创建了一个脚本,它使用Simple HTML DOM Parser从另一个站点获取内容.看起来像这样

include_once('simple_html_dom.php');

$html = file_get_html('http://csgolounge.com/'.$tradeid);       

foreach($html->find('div[id=tradediv]') as $trade) {
    $when = $trade->find('.tradeheader')[0];
 }
Run Code Online (Sandbox Code Playgroud)

我可能经常寻找内容(每30秒),现在我得到空的html.

我试着像这样更改用户代理

$context = stream_context_create();
stream_context_set_params($context, array('user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6\r\n'));
$html = file_get_html('http://csgolounge.com/profile?id='.$steamid, 0, $context);
Run Code Online (Sandbox Code Playgroud)

但我仍然回到空的HTML.

Ton*_*niD 5

问题是我的html文件太大了.简单的html dom定义了最大文件大小define('MAX_FILE_SIZE',600000).我将它改为900000,现在再次工作.