Phi*_*hov 1 php parsing simple-html-dom
我使用SIMPLE HTML DOM进行解析.当我尝试获取内容时,有些页面需要很长时间.我需要设置限制(例如10秒) - >转到下一页.请不要插座!
小智 7
您可以使用HTTP 上下文选项
所以代码看起来像
$options = stream_context_create(array('http'=>
array(
'timeout' => 10 //10 seconds
)
));
echo file_get_contents('http://example.com/', false, $options);
Run Code Online (Sandbox Code Playgroud)