0 votes
in Programming by (270 points)

Can you help me i am trying to parsing HTML and XML and extract information ?

1 Answer

0 votes
by (300 points)
edited by

For parsing you can use HTML DOM to retrieve data , Like you can load DOM and can iterate the nodes as per your need for example

$doc = new DOMDocument();

// Get the sourcecode of the domain



//here we are collecting all div tags from web page

$div = $doc->getElementsByTagName('div');


foreach($books as $div)



$class = $div->getAttribute('class');

if (strpos($class, 'price') !== false)



echo $class->nodeValue;





For more understanding  you can see this Answer.


you also can use this script .




Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated