PHP to save external file
Moderator: General Moderators
PHP to save external file
I've been trying to find some help with a php script that allows a user to enter a URL and pulls a file (a single JPG) by matching it with a regular expression, saving it to the local server. Our previous programmer wrote the original script in Perl and used wget to do this - is there a simple way of doing it in PHP? I appreciate any and all advice.
Re: PHP to save external file
you can use the move_uploaded_file() function...
the syntax is simple you just need to specify the source URl then the destination URL
then the file will be copied
the syntax is simple you just need to specify the source URl then the destination URL
then the file will be copied
Re: PHP to save external file
From the examples it looks like this can only be used with files that are currently on the server already. Can this be used to save a file from a different (remote) server? For instance, my current script is on domain1.com and I would like to save the image I have at domain2.com/image2.jpg.
Thanks for the quick response!
Thanks for the quick response!
Re: PHP to save external file
copy() works with remote files if you've got fopen wrappers switched on.