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.