Hi everyone!
In our workflow we get new product images from a vendor's server each day. They put them up on a normal web page for anyone to download. I am trying to automate the process that we don't have to manually download a file each day and then upload to our server. Is there a PHP function similar to wget where I can request a certain file on a remote web page and have it saved to a directory on our server? Note that some files might be as large as 100MB.
Thanks!
Todd
PHP file transfer between servers?
Moderator: General Moderators
-
amazingrando
- Forum Newbie
- Posts: 2
- Joined: Mon Dec 13, 2010 7:01 pm
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: PHP file transfer between servers?
Not to be presumptuous, but what's wrong with wget?
-
amazingrando
- Forum Newbie
- Posts: 2
- Joined: Mon Dec 13, 2010 7:01 pm
Re: PHP file transfer between servers?
wget might be the best route. One of the problems I face is that the images I want to transfer are dynamically serviced with a URL like this: http://www.company.com/getimage.aspx?mediaid=785208. wget will correctly recognize it as an image of JPEG file type, but it saves it without an extension.
Maybe there's a better forum for this, but how would I get the mime type from wget and give the file the appropriate extension?
Maybe there's a better forum for this, but how would I get the mime type from wget and give the file the appropriate extension?
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: PHP file transfer between servers?
I just happen to know a bit about bash scripting
. If the file extension is a known constant (like .ISO), you can do it like this:
Code: Select all
wget -O outputfile.iso http://www.company.com/getimage.aspx?mediaid=785208