Re: Quick question.
| From: | Simon Angell | Date: | Tue, 01 Oct 2002 17:13:19 +0000 |
| Subject: | Re: Quick question. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118393@lists.php.net to get a copy of this message | ||
i tried that ine and got this...
Warning: fopen("/test/canberra.txt", "w+") - No such file or directory in
C:\Xitami\webpages\bomonster\test2.php on line 4
code..
<?php
$rContents = implode( "\n", file(
'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10035.txt'
) );
if( ($fp = fopen( '/test/canberra.txt', 'w+' )) !== false )
{
fputs( $fp, $rContents );
fclose( $fp );
}
?>
I think i know what the probelm is.
.if( ($fp = fopen( '/test/canberra.txt', 'w+' )) !== false )
should be
if( ($fp = fopen( 'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10035.txt'
,
'w+' )) !== false )
But, where do i put the file name and directory to write?
--
Cheers
---------------------------------------------------------
Simon Angell
Canberra ACT
www.canberra-wx.com
---------------------------------------------------------
Member of:
Australian Severe Weather Association.
www.severeweather.asn.au
---------------------------------------------------------
This email is virus free.
Scanned before leaving my mailbox
using Norton Antivirus 2002 for Win2k
Scanned with the latest definition File.
"Robert Cummings" <robert.cummings@webmotion.com> wrote in message
news:3D99C5B5.182CE6F6@webmotion.com...
> 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 |
> `----------------------------------------------'