jeffreyappel Posted September 4, 2014 Share Posted September 4, 2014 I want that my script remotely download a file on the server from another server and save it remotly on the server. For example my script is located on http://mydomain.com/download_script.php The file I want to download is on http://otherdomain.com/file.zip Then I want to save it to http://mydomain.com/file.zip ----------- to the local server folder I found a way how to parse HTML code remotly, but haven't found how to download files, please help me to find the right function. Quote Link to comment https://forums.phpfreaks.com/topic/290850-download-and-save-file-remotely/ Share on other sites More sharing options...
mentalist Posted September 4, 2014 Share Posted September 4, 2014 Best way to get the served page is using curl: http://php.net/manual/en/curl.examples-basic.php Quote Link to comment https://forums.phpfreaks.com/topic/290850-download-and-save-file-remotely/#findComment-1489885 Share on other sites More sharing options...
Dippy Posted September 6, 2014 Share Posted September 6, 2014 Hi, Tried the example from php manual along with authentication but it gives "bad request" error. Using PHP 5.4. regards Quote Link to comment https://forums.phpfreaks.com/topic/290850-download-and-save-file-remotely/#findComment-1490166 Share on other sites More sharing options...
jazzman1 Posted September 7, 2014 Share Posted September 7, 2014 A chance to see some part of your actual code? Quote Link to comment https://forums.phpfreaks.com/topic/290850-download-and-save-file-remotely/#findComment-1490244 Share on other sites More sharing options...
jeffreyappel Posted September 30, 2014 Author Share Posted September 30, 2014 (edited) I also had a problem with cUrl. In my case it was to setting appropriate headers, i had to simulate a real user to make things work. Edited September 30, 2014 by jeffreyappel Quote Link to comment https://forums.phpfreaks.com/topic/290850-download-and-save-file-remotely/#findComment-1492450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.