Remote file download problems.

Source: Internet
Author: User
Remote file download problems... I have a remote path, http: // www/images/, which contains a lot of images .. if you want to download it, I wonder if there is any proper solution? No file name .. only the path name .., first make sure that this directory is readable opendir () and then readdir () and then read PHPcodefunctionGrabImage ($ url) {remote file download problems...
I have a remote path
Http: // www/images/

There are a lot of images in it .. I want to download it. I wonder if there is any proper solution?

No file name... only path name ..

------ Solution --------------------
First, make sure that the directory is readable.
After opendir (), readdir () is read using the following letter.
PHP code
Function GrabImage ($ url) {if ($ url = ""): return false; endif; $ filename = 'qq /'. strrchr ($ url, "/"); ob_start (); readfile ($ url); $ img = ob_get_contents (); ob_end_clean (); $ size = strlen ($ img ); $ fp2 = @ fopen ($ filename, "a"); fwrite ($ fp2, $ img); fclose ($ fp2); return $ filename ;}
------ Solution --------------------
Discussion

If it cannot be read... is there any way...

------ Solution --------------------
Remote access to http: // www/images/

In this way, access to the server configuration of 90% will tell you the English answer "access denied "!

Therefore, we recommend that you give up on this plan. unless you have the permission to control the remote server, no PHP code can be used to obtain any files. Or you know the file name of each image in this directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.