2
I am trying to capture a div from its class but did not succeed, notice: I try to capture the div with the class class='m-definicao-conteudo'
of the site that I inform to Curl, but returns me 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;
}
It seems that the HTML is not in condition or is not being collected in full.
– Zuul
Strange because it is collected whole by Curl
– Vinícius Lara