|
|
|
|
![]() ![]() |
Feb 8 2005, 10:41 AM
Post
#1
|
|
|
End Of Computer Group: Members Posts: 346 Joined: 1-September 04 From: .:: MARS ::. Member No.: 28 |
hi
i need a php or java script code for downloading files from other sites to my site for example: http://download.com/file.zip to http://mysite.com/file.zip thanks This post has been edited by microscopic^earthling: Apr 19 2005, 01:24 PM |
|
|
|
Feb 8 2005, 11:31 AM
Post
#2
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 20 Joined: 8-February 05 Member No.: 2,561 |
afaik, this isnt possible in php. even if it was, youd have to open up permissions, which would leave youre site and possibly the server insecure.
youre better off using a program such as filezilla, which will run on your computer and do what you want. |
|
|
|
Feb 8 2005, 11:57 AM
Post
#3
|
|
|
S.P.A.M.S.W.A.T. Group: Members Posts: 814 Joined: 22-January 05 From: San Antonio, Texas (No, I'm not dumb. I just moved here...) Member No.: 2,284 |
Yeah, I don't think it's possible through java or php. I think you'd have to download the file to your computer, then upload it to your site.
Some file managers can upload directly from another site though, but still not automatically. |
|
|
|
Feb 8 2005, 01:12 PM
Post
#4
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 |
I dont think so.. you can create a directory for open uploads and set the permissions for just that directory such that any normal ftp user would get jailed to that directory. As for your ftp script, try http://th.php.net/ftp --> that will get you started. The first script I found on that page is given here:
QUOTE <?php // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } // upload the file $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo "FTP upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; } // close the FTP stream ftp_close($conn_id); ?> [/tab] If you study the script a little carefully you'll see it's quite possible to modify it and have two sets of $ftp_username/$ftp_user_pass and $ftp_server variables - one for download and one for upload respectively. Then just use the ftp_get() function to fetch the file from one server and use ftp_put() to put it on your other server. You can use this whole thing as a function such that as soon as the file is uploaded to one of your servers, the upload function will call the other one and copy the file over to your other server. [tab]If you still don't get me - post again and I think I can write up a little modified script to suit your needs. All the best |
|
|
|
Feb 8 2005, 06:36 PM
Post
#5
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 20 Joined: 8-February 05 Member No.: 2,561 |
awesome. thanx for sharing that. ive learnt a few things from that
|
|
|
|
Feb 8 2005, 09:01 PM
Post
#6
|
|
|
End Of Computer Group: Members Posts: 346 Joined: 1-September 04 From: .:: MARS ::. Member No.: 28 |
Hi,
i found a php script, it is very very simple just you shoud type your favorable file below CODE <?php if(!copy("http://www.1-language.com/audiocourse_dwnld/AmericanEnglishCourse.zip", "AmericanEnglishCourse.zip")) { echo("failed to copy file"); } ; ?> NOTE: you shoud chmod your directory to 777 thanks for your post, every body |
|
|
|
Feb 8 2005, 09:17 PM
Post
#7
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 |
QUOTE(soleimanian @ Feb 9 2005, 04:01 AM) Hi, i found a php script, it is very very simple just you shoud type your favorable file below CODE <?php if(!copy("http://www.1-language.com/audiocourse_dwnld/AmericanEnglishCourse.zip", "AmericanEnglishCourse.zip")) { echo("failed to copy file"); } ; ?> NOTE: you shoud chmod your directory to 777 thanks for your post, every body Thanks, but does that fulfill your primary objective --> that of copying the files off one server and dumping them on another ?? This looks more like a copy from one directory to other on the same server - kind of script... |
|
|
|
Feb 8 2005, 11:11 PM
Post
#8
|
|
|
End Of Computer Group: Members Posts: 346 Joined: 1-September 04 From: .:: MARS ::. Member No.: 28 |
QUOTE(microscopic^earthling @ Feb 9 2005, 12:47 AM) Thanks, but does that fulfill your primary objective --> that of copying the files off one server and dumping them on another ?? This looks more like a copy from one directory to other on the same server - kind of script... No my dear i saved it in a php file and upload to my serever and test it after just 3 secends asta copied it |
|
|
|
Apr 28 2008, 09:50 AM
Post
#9
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
File download from FTP server using filezilla
Php Script To Download File From Another Site I am creating website by using php(xampp).I have to download files from FTP server. So I installed filezilla server in xampp.After if I execute the php program the browser shows---- "Fatal error: Maximum execution time of 60 seconds exceeded in " What should I do????????????????????????????????????????????? -reply by selva |
|
|
|
Apr 29 2008, 07:34 PM
Post
#10
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
very useful
Php Script To Download File From Another Site Replying to miCRoSCoPiC^eaRthLinG Thanks for all; -reply by Max B |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 30th August 2008 - 04:30 PM |