how to print text from <p>
tag using curl
and DOMDocument
i try like this but not showing anything.
<?php
$url = "http://www.blablabla.org/dorama/201105455/kimi-wa-petto";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$html = curl_exec($ch);
curl_close($ch);
$dom = new DOMDocument();
@$dom->loadHTML($html);
foreach($dom->getElementsByTagName('p') as $link) {
echo $link->getAttribute('p');
echo "<br />";
}
?>