simple dom parser double find() doesn't work?

118 views Asked by At

enter image description here

Above is my DOM and I expect to get 4 hour ago but I got an error

Fatal error: Call to a member function find() on a non-object 

My php look like this

$time_ago = $html->find('.entry .unvoted',0)->find('.tagline .live-timestamp',0)->plaintext;

echo $time_ago;

I know I could do with one find(), which will be find('tagline .live-timestamp') but I wonder why double find() doesn't work.

1

There are 1 answers

0
Elton Jamie On

I got it work by this

$time_ago = $go->find('.entry',0)->find('.tagline .live-timestamp',0)->plaintext;

because there's more than one class called unvoted