1
I’m trying to get a class from a news site, but I’m not getting it.
$titulo = $html->find('feed-post-body-title gui-color-primary gui-color-hover', 0)
->innertext;
echo $titulo;
You’re making that mistake:
Notice: Trying to get Property of non-object
How do I get classes or ids?
Friend, the variable
$html
is getting what exactly?– Lucas Fontes Gaspareto
$html = file_get_html('url_do_site');
– João Victor Valentim
Ta getting the site url I want to get the class
– João Victor Valentim
Friend, try as this example
foreach($html->find('img') as $element) 
 echo $element->src . '<br>';
However, maybe your return of file_get_html is giving error, or the variable$html
is as an array, you have to find out exactly what is the return of the function and in what state or what content exists inside the variable.– Lucas Fontes Gaspareto
Get the normal HTML objects I can... The problem is getting some object with a certain ID or Class css
– João Victor Valentim
Take a look at the answer to that question http://stackoverflow.com/questions/15761115/find-div-with-class-using-php-simple-html-dom-parser I think that’s exactly what you should do.
– Lucas Fontes Gaspareto
Thanks friend! It helped a lot!
– João Victor Valentim