I get no data when download images

笑着哭i 提交于 2021-02-11 14:53:27

问题


so iam trying to download images by this code i successfully download the images but they without any data and corrupted

like the images have 0 bytes

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 );

    }

来源:https://stackoverflow.com/questions/60595966/i-get-no-data-when-download-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!