I’m using simple html dom to get data from a website.
My problem is when i find a div with a specify class it return all the div tag which have that class.
I’m want content in the first div with that class only.
My code is like this
$html = file_get_html('myurl'); $e = $html->find("div[class=myclass]",0); echo $e->plaintext;
How can i get the first div with myclass only.
Sorry for my bad English
Try this alternative method,
$e = $html->find("div[class=myclass]"); echo $e->plaintext;
However I think, it should also work with
it could be because you are using old version of
For me, I only had to change $html =
$html = str_get_html(file_get_contents(myurl)); for my version of