I want do a web crawler news. I want load content from link http://vnexpress.net/tin-tuc/ban-doc-viet/xa-hoi/chay-xe-may-theo-taxi-moi-biet-bi-chem-60-000-dong-2865724.html and i want get all content div with class fck_detail and keep original tag from it . How to do this ?
<div class="fck_detail">
<p class="Normal" style="text-align:justify;">Some texts</p>
<p class="Normal" style="text-align:justify;">some texts</p>
<p class="Normal" style="text-align:justify;">Some texts</p>
<p class="Normal" style="text-align:justify;">Some texts</p>
</div>
I tried but not success
$doc = new DOMDocument();
$doc->loadHTMLFile("http://example.com/some.html");
$selector = new DOMXpath($doc);
$node = $selector->query('//div[@class="fck_detail"]')->item(0);
echo trim($node->nodeValue);
The above code gives me the plain text stripped from all HTML only. But I want to keep the HTML.