I'm trying to capture a div from its class, but I did not succeed, note: I try to capture the div with the class class='m-definicao-conteudo'
of the site that I report to curl, but I get this error:
Warning:
DOMDocument :: loadHTML (): Unexpected end tag: a in Entity, line: 102 in /Applications/XAMPP/xamppfiles/htdocs/teste.php on line 13
$ch = curl_init ("");
curl_setopt($ch, CURLOPT_URL, 'http://dicionarioinformal.com.br/aham/');
curl_setopt($ch, CURLOPT_USERAGENT, "Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/870; U; id) Presto/2.4.15");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$html = curl_exec($ch);
$dom = new DOMDocument;
$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$results = $xpath->query("//*[@class='m-definicao-conteudo']");
if ($results->length > 0) {
echo $review = $results->item(0)->nodeValue;
}