I use SIMPLE HTML DOM for parsing. Some pages take a very long time when i try to get contents. I need to set limit (for example 10 sec) -> go to the next page. Please without socket!
You can use the HTTP context option
So the code would look like
$options = stream_context_create(array('http'=>
array(
'timeout' => 10 //10 seconds
)
));
echo file_get_contents('http://example.com/', false, $options);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With