Crawler symfony2 filter show node list empty

664 views Asked by At

Im scraping a web using Goutte/Symfony2 and i have a problem with a filter,

i have in $msg the crawler (part of the web), if i print the html i can see inside of $msg a div with class .mola, why if i filter $msg to get the text from .mola i get The current node list is empty ?

$msg = '<div class="mola_wrap"> 
            <span class="mola" title="titleinside">109</span>'; // in $msg are more code

$msg->filter('.mola')->text();

Thank you!!

1

There are 1 answers

6
Hmmm On BEST ANSWER

Assuming that $msg is a Crawler object which contains this html

<div class="mola_wrap"> 
    <span class="mola" title="titleinside">109</span>
</div>

your code is just fine, maybe the website you are crawling does not have .mola class in some pages