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.