Reputation: 4455
This may be possibly duplicate.
but I want to know that how can I get text from a paragraph using simple HTML DOM Parser or something else which have a more button (perhaps prefferably called a link) at the end of paragraph.
e.g
This is test string and I want to get this data but don't know how to
[more...]
and the actual text is
This is test string and I want to get this data but don't know how to get it
Please anybody help me.
So anyone who could explain how can I get this complete paragraph. Thanks in advance
Upvotes: 2
Views: 135
Reputation: 4953
All the source code of this web page is reformatted and rearranged using JavaScript, and since Simple HTML DOM doesnt handle JS, you must work on the raw code (before JS alterations) wich you can check using ctrl+U... Then, based on it, you write your parser correctly...
He're a working code answering your question:
// includes Simple HTML DOM Parser
include "simple_html_dom.php";
$url = 'http://www.linkedin.com/company/1015?trk=vsrp_companies_res_name&trkInfo=VSRPsearchId%3A2646459271384809644652%2CVSRPtargetId%3A1015%2CVSRPcmpt%3Aprimary#';
//Create a DOM object
$html = new simple_html_dom();
// Load HTML from a string
$html->load_file($url);
// Get the node having "text-logo" class
$div = $html->find('div.text-logo', 0);
echo $div;
echo "<hr>";
// Get logo node
$logo = $html->find('img.logo', 0);
echo $logo->alt ." => ". $logo->src;
// Clear dom object
$html->clear();
unset($html);
Upvotes: 2