Reputation: 943
So this error is killing me, heres the code:
$html = file_get_html('vids.html');
foreach($html->find('a') as $element) {
echo $element->name
}
Upvotes: 0
Views: 4186
Reputation: 9148
I think you should var_dump($element) inside the loop and see if it has the 'name' property set. YOu could modify your condition and add isset() in the loop,
foreach($html->find('a') as $element) {
if(isset($element->name)){
echo $element->name;
}
}
Upvotes: 0
Reputation: 745
Did you include the simple_html_dom.php file first?
include_once('/simple_html_dom.php');
And is your vids.html in the same directory you are calling from?
Upvotes: 1