I’m using simple_html_dom which is a predefined webcrawler class with various methods.
I have the following:
$html = new simple_html_dom();
$arrayoflinks = //this is where I have a list of links//;
foreach($arrayoflinks as $eachlink){
$html->load_file($eachlink); //these are methods from the simple html_dom
$html->find('a'); //these are methods from the simple html_dom
//run a function I already wrote
}
The issue is that the $html in the foreach loop is not being recognized. My Netbeans IDE is telling me that the $html in the foreach loop is introducing a new variable, which implicitly means it’s not being recognized as the class method.
How can I get around this?
EDIT: Turns out the error was something else. Accessing the method in the above foreach loop is valid.
After the OP posted the error message, once more as answer:
PHP has a default execution time for scripts. Once this runtime is over, the script aborts with an error message.
Either increase the maximum runtime in php.ini (don’t forget to restart your webserver), or reduce the amount of things the script has to do (for example by reducing the amount of URLs to parse).