Simple dom double find () parser not working?

enter image description here

Above is my DOM and I expect to get 4 hours ago but I got the error

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

      

My php looks like this

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

echo $time_ago;

      

I know I could work with one find () that would find('tagline .live-timestamp')

, but I'm wondering why double find () doesn't work.

+3


source to share


1 answer


I got a job from this

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

      



because there is more than one class named unvoted

0


source







All Articles