1

i was working with html dom parser(got it from http://simplehtmldom.sourceforge.net/) to extract images from websites . so i put every websites i want to extract images from in an array but then if i put it inside a for loop the code is not working . sorry for my bad english

<?php
require("html/simple_html_dom.php");
$aray = array("www.google.com","www.yahoo.com");
for($xx=0;$xx<count($aray);$xx++)
{
 $html=file_get_html($aray[$xx];
  foreach($html->find('img') as $element)
   echo $element->src . '<br>';
}
?>     
  • 1
    Use cURL instead to download the pages, then parse them with simple_html_dom... Here's some examples on how to proceed: [`Example 1`](http://stackoverflow.com/a/18668562/1519058) [`Example 2`](http://stackoverflow.com/a/21186309/1519058) – Enissay Dec 29 '14 at 03:34
  • And don't mix for and foreach loops, you'll confuse yourself. Stick to foreach. – pguardiario Dec 30 '14 at 00:32

0 Answers0