i trying to download images but i get only one image

التقنية tech :

so i trying to download images from this url = https://mangaarabteam.com/manga/yuan-zun/94/ but i get only one image

this code in: manga.php

include('simple_html_dom.php');

$url = 'https://mangaarabteam.com/manga/yuan-zun/94/';

 $html = file_get_html($url);

foreach($html->find('img') as $e){

  $image_links =  $e->src;

  $images_url = array();

 array_push( $images_url, $image_links);

this code in : index.php

foreach( $images_url as $image ){

                    print_r($image);
          }

i want the output $image multiple images not only on image

Dilip Hirapara :

Try the below code.

you're setting your empty array($images_url = array();) inside the foreach it should be before the foreach.

$url = 'https://mangaarabteam.com/manga/yuan-zun/94/';
$html = file_get_html($url);

$images_url = array();
foreach($html->find('img') as $e){
  $image_links =  $e->src; 
  array_push( $images_url, $image_links);
}

foreach( $images_url as $image ){
        print_r($image);
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=293287&siteId=1