adhossain Posted February 8, 2012 Share Posted February 8, 2012 I want to use a php script so that when I access the page, the browser copy the file from server to another server. Say, a file is in www.google.com/file.exe and when I open the page, the file will be copied to www.myserver.com/download location. pls tell me indetails coz I know only a little about PHP.Thanks Link to comment Share on other sites More sharing options...
birbal Posted February 8, 2012 Share Posted February 8, 2012 You can use file_get_contents() to get a remote file then you can use file_put_contents() to write to second server where the script will run. Second server must have url file open option in php.ini on Link to comment Share on other sites More sharing options...
justsomeguy Posted February 9, 2012 Share Posted February 9, 2012 If file_put_contents is not an option then you can also use the FTP functions. http://www.php.net/manual/en/book.ftp.php Link to comment Share on other sites More sharing options...
boen_robot Posted February 11, 2012 Share Posted February 11, 2012 I haven't actually tried this, but I believe you should be able to do things with just copy(), like: copy('http://www.google.com/file.exe', 'ftp://user:pass@www.myserver.com/download/file.exe'); (assuming "user" and "pass" are adjusted to your actual credentials for your FTP server that should be running on www.myserver.com) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.