Welcome Guest ( Log In | Register )




                Web Hosting Guide

2 Pages V   1 2 >  
Closed TopicNew 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
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,248
Joined: 29-January 05
From: Bangkok, Thailand
Member No.: 2,411
myCENTs:19.10


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);
?>


     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.
    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,248
Joined: 29-January 05
From: Bangkok, Thailand
Member No.: 2,411
myCENTs:19.10


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

2 Pages V   1 2 >
Closed TopicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   7 starscream 74 20th November 2009 - 05:20 PM
Last post by: starscream
No new   27 Marcella 6,821 20th November 2009 - 02:52 PM
Last post by: iG-Ashley
No new   32 NilsC 18,492 20th November 2009 - 12:15 PM
Last post by: iG-topcathunter
No New Posts   15 Lancer 429 18th November 2009 - 07:47 PM
Last post by: yordan
No New Posts   18 takerraj 268 18th November 2009 - 12:31 AM
Last post by: HannahI
No new 39 JasPuneet 3,238 18th November 2009 - 12:20 AM
Last post by: HannahI
No New Posts   5 PigFat 2,225 16th November 2009 - 11:31 PM
Last post by: iG-Demonz Media
No New Posts   14 kanade 4,260 12th November 2009 - 07:55 PM
Last post by: iG-Ram
No New Posts   5 dungsport 2,649 12th November 2009 - 07:09 AM
Last post by: Quatrux
No New Posts   14 rapco 7,980 6th November 2009 - 07:14 AM
Last post by: iG-Rajeesh
No New Posts 5 Niru 3,788 5th November 2009 - 08:04 AM
Last post by: iG-balajee
No New Posts  
4 PHP
7 bluefish 2,796 3rd November 2009 - 09:29 PM
Last post by: HannahI
No New Posts   14 PureHeart 10,013 30th October 2009 - 03:45 AM
Last post by: iG-butter1093
No New Posts   9 luckyboy3123 5,257 29th October 2009 - 03:08 AM
Last post by: iG-butter1093
No New Posts   10 yordan 2,215 27th October 2009 - 11:31 PM
Last post by: HannahI


Web Hosting Powered by ComputingHost.com.