Re: Quick question.
| From: | Robert Cummings | Date: | Tue, 01 Oct 2002 15:56:37 +0000 |
| Subject: | Re: Quick question. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118384@lists.php.net to get a copy of this message | ||
Simon Angell wrote:
>
> Hi everyone.
> I asked this a week or so ago but i am unsure if it got to the list, so here
> we go again.
>
> I am trying to get a remote file to be copied onto my own web server, I have
> looked at fopen() and fread() and fwrite() and get the general idea of each,
> but im wondering how to join the commandes to get the file i want from the
> remote ftp server, copied and written onto my own server.
Something like the following might work (not tested AT ALL):
$rContents = implode( "\n", file( 'ftp://www.foo.bar/me/my/data.txt' ) );
if( ($fp = fopen( '/tmp/myFile.txt', 'w+' )) !== false )
{
fputs( $fp, $rContents );
fclose( $fp );
}
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:robert.cummings@webmotion.com |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'