how to thansfer file between ftp,and http to ftp?

how to transfer file between ftp,and http to ftp?can use php to do this?
gamebossAsked:
Who is Participating?
 
rbrindlConnect With a Mentor Commented:
Of course you can use PHP.
The normal file-system-functions (see php-manual at www.php.net) can work with almost any kind of URL (HTTP,FTP) so you simply open a file-pointer at the source and one at the destination and write through:
Pseudo-code:

$fin = fopen( $URLin, "r" );
$fout=fopen($URLout,"w");
while(!feof($fin))
    fwrite($fout,fread( $fin, 1024), 1024 );
fclose($fin);
fclose($fout);

1024 is just a number i usually choose. its a kind of block-size for this transfer-operation. if your files normally are very large, performance will increase, if you are increasing this number
this piece puts anything from anywhere to anywhere.
I use a similar code for distributing and managing mp3-files in a distributed storage network which can interactively be accessed via web-browser.
0
 
cable4096Commented:
Not sure what you want; however, maybe this web site can show you some examples of getting external files with ftp and/or http:

http://www.faqts.com/knowledge-base/view.phtml/aid/149/fid/2

0
 
aikonCommented:
Hi Gameboss,

You can open sockets with the Network Functions (look at PHP's manual, page 175)

Regards
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
gamebossAuthor Commented:
have any example script?
0
 
gamebossAuthor Commented:
Adjusted points to 75
0
 
gamebossAuthor Commented:
how to transfer file between ftp,and http to ftp?can use php to do this?
how to do this?detailed please.
have any example scripts?
0
All Courses

From novice to tech pro — start learning today.