I have following html file
<body>
<div class="container">
<div class="list">
<ul>
<li>
<a href="http://website1.com" ><img src="image1.jpg"></a>
</li>
<li>
<a href="http://website2.com" ><img src="image2.jpg"></a>
</li>
<li>
<a href="http://website3.com" ><img src="image3.jpg"></a>
</li>
....
....
....
</ul>
</div>
</div>
</body>
By parsing the above html file. I want output like this..
http://website1.com
image1.jpg
http://website2.com
image2.jpg
http://website3.com
image3.jpg
....
....
By seeing above output, you can guess that I only need 'href' and 'src' value of each list item.
I am trying to parse by using 'simple_html_dom' 3rd party plugin.
<?php
include_once('simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file("html_file.html");
foreach($html->find('div[class=list] ul li') as $li)
{
echo $li->find('a')->href."<br />";
echo $li->find('img')->src."<br />";
}
?>
but the above code doesn't work. Please tell me if i did anything wrong or else use can assist me by using PHP DOM module if you know.