I have a code that will scrap some data from a website using PHP DomDocument. However, I would like to specify the timeout duration. Is there any way to do so?
The code that I have is something like this:
<?php
$grep = new DoMDocument();
@$grep->loadHTMLFile("http://www.example.com");
$finder = new DomXPath($grep);
$class = "Cat";
$nodes = $finder->query("//*[contains(@class, '$class')]");
foreach ($nodes as $node)
{
//coding
}
?>
Thanks!