Welcome Guest ( Log In | Register )



 
Closed TopicStart new topic
> Php Script To Download File From Another Site
soleimanian
post Feb 8 2005, 10:41 AM
Post #1


End Of Computer
Group Icon

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
Go to the top of the page
 
+Quote Post
hasan
post Feb 8 2005, 11:31 AM
Post #2


Newbie [ Level 2 ]
Group Icon

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.
Go to the top of the page
 
+Quote Post
szupie
post Feb 8 2005, 11:57 AM
Post #3


S.P.A.M.S.W.A.T.
Group Icon

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.
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Feb 8 2005, 01:12 PM
Post #4


PsYcheDeLiC dR3aMeR
Group Icon

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 smile.gif
Go to the top of the page
 
+Quote Post
hasan
post Feb 8 2005, 06:36 PM
Post #5


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 20
Joined: 8-February 05
Member No.: 2,561



awesome. thanx for sharing that. ive learnt a few things from that wink.gif
Go to the top of the page
 
+Quote Post
soleimanian
post Feb 8 2005, 09:01 PM
Post #6


End Of Computer
Group Icon

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
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Feb 8 2005, 09:17 PM
Post #7


PsYcheDeLiC dR3aMeR
Group Icon

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...
Go to the top of the page
 
+Quote Post
soleimanian
post Feb 8 2005, 11:11 PM
Post #8


End Of Computer
Group Icon

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
Go to the top of the page
 
+Quote Post
iGuest
post Apr 28 2008, 09:50 AM
Post #9


Newbie [ Level 1 ]
Group Icon

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
Go to the top of the page
 
+Quote Post
iGuest
post Apr 29 2008, 07:34 PM
Post #10


Newbie [ Level 1 ]
Group Icon

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
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How Do U Make Members Only Web-site(7)
  2. Trainable Anti-spam Filter Script(3)
  3. Need Help With A PHP - MySQL Registration Script(13)
  4. What Would Make A Good Registration Script?(4)
  5. How To Delete File Using PHP Shell Script(3)
  6. How To Force A Zip File To Be Downloaded(11)
  7. Online Multiplayer Chess Script(2)
  8. Automated File Structure Creation Script(3)
  9. Authentication Script(1)
  10. Login Script(5)
  11. Please Help (php Join Script)(5)
  12. Automatic/remote Php Script Execution(9)
  13. Php File Upload(3)
  14. Something Wrong With This Script?(9)
  15. Extplorer(7)
  1. Automated Product Suggestion Script(2)
  2. Run A Script When Expires A Session(6)
  3. Php Script Help(1)
  4. SQL Doesn't Connect In PHP Script(19)
  5. Warning: Mysql_result(): Supplied Argument Is Not A Valid Mysql Result Resource In ...(4)
  6. Password Recovery Script(6)
  7. Login Script(8)
  8. Free Forum Hosting Type Script Help!(2)
  9. Script Request(2)
  10. Writing And Testing My Own Login Script [solved](20)
  11. Make A Script Run Even If No User Is Online(6)
  12. Php Login Script(0)
  13. Myspacetv Download Php Script Help(6)


 



- Lo-Fi Version Time is now: 30th August 2008 - 04:30 PM