Jump to content
xisto Community
Sign in to follow this  
soleimanian

Php Script To Download File From Another Site

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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://forums.xisto.com/no_longer_exists/ --> that will get you started. The first script I found on that page is given here:

 

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

Share this post


Link to post
Share on other sites

Hi,

i found a php script,

it is very very simple just you shoud type your favorable file below

<?phpif(!copy("http://http://www.1-language.com/audiocourse/unit28_internationalcall_rslt.htm;, "AmericanEnglishCourse.zip")){echo("failed to copy file");};?>

NOTE: you shoud chmod your directory to 777

thanks for your post, every body

Share this post


Link to post
Share on other sites

Hi,

i found a php script,

it is very very simple just you  shoud type your favorable file below

<?phpif(!copy("http://http://www.1-language.com/audiocourse/unit28_internationalcall_rslt.htm;, "AmericanEnglishCourse.zip")){echo("failed to copy file");};?>

NOTE: you shoud chmod your directory to 777

thanks for your post, every body

<{POST_SNAPBACK}>


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...

Share this post


Link to post
Share on other sites

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...

<{POST_SNAPBACK}>


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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I seek for a automatic php script , can be able to upload files from public area of web to a specific location in my server, for example, automatically upload "index.Htm" from :"http://forums.xisto.com/no_longer_exists/; to "/public_html/updates/" and repeat this action evry 10 minutes.And also when I close my browser it remains active on server.Any ideas?

Share this post


Link to post
Share on other sites
Its workingPhp Script To Download File From Another Site

Its working for me.All you have to do is edit the location file on the script and file name save to. It works with any file extension.

-reply by 6monkeyrs

 

Share this post


Link to post
Share on other sites
Exec. timePhp Script To Download File From Another Site

put

 set_time_limit(0);

at file start after php tag. This will resolve exec. Time  issue

-reply by Azghanvi

 

Share this post


Link to post
Share on other sites

Replying to FeedBackerHey Selva! You should try changing stuff a bit in the "php.Ini" file in your server. So, do these:-1. Open up 'php.Ini' in notepad or some text editor.2. Find for the term "max_execution time = 60"3. Change it to something of your choice. I.E., it's in seconds. So its 60 seconds (a minute) for your server. You can change it to something say, 120 seconds (2 minutes!) or you could set it to '0' for achieving a 'infinite execution time'.Note:- This will change the maximum script execution time for all the PHP scripts on your server! In case you don't want that, You could give this at the start of your script:-Set_time_limit(0)This will ensure that only that script has got an infinite time to do its job! Not all the scripts you've got! Which means you are no going to eat away your server system resources!Hope that helps!Sidd

-reply by Siddharth

Share this post


Link to post
Share on other sites
That script screamsPhp Script To Download File From Another SiteReplying to miCRoSCoPiC^eaRthLinGI move large files from one server to another. All I need is the link to the file on the first server. With ftp access to the second server I edited the details of the script and executed the page and copied a 15MB file faster than I could imagine possible. Thank you. This scripts screams!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.