下载图像时没有数据

时间:2020-03-09 07:06:21

标签: php arrays web-crawler domcrawler

所以我试图通过此代码下载图像,我成功下载了图像,但是它们没有任何数据并且已损坏

就像图像有0个字节

function get_chapter_images(){

include('simple_html_dom.php');

$url = 'http://localhost/wordpress/manga/manga-name-ain/chapter-4/';


 $html = file_get_html($url);

 $images_url = array();

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

  $image_links =  $e->src;

array_push( $images_url, $image_links);

   }

   return $images_url;

}
$images_links = get_chapter_images();

    foreach( $images_links as $image ){

        $imag_fliter = str_replace( '?ssl=1', '', $image );

        $data = @file_get_contents( $image );

                $pathinfo = pathinfo( $image );

                    $file_name = $pathinfo['basename'];

                    @file_put_contents("manld/$file_name", $data );

    }

0 个答案:

没有答案