Re: transfer file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kristianto adi widiatmoko wrote:
i try to transfer file from one server to another server, lets call it server A to server B.

My Idea is like this I place my script in server A

<?php
$local = fopen("file.txt","r");
$remote = fopen("http://B/file.txt","w+);

while(!feof($local)) {
    $buff = fread($local,1024);
    fwrite($remote, $buff);
}

fclose($local);
fclose($remote);

?>

Is Any one has sugestion about it, or another method ??

You can't write files to a remote server through a web server like this.

The php page (http://php.net/fopen) has an example of what you want:

$handle = fopen("ftp://user:password@xxxxxxxxxxx/somefile.txt";, "w");

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux