Re: Quick question.

From: Date: Tue, 01 Oct 2002 18:01:03 +0000
Subject: Re: Quick question.
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-118398@lists.php.net to get a copy of this message
Windows makes me cry... this will fix the problem... Change: $rContents = implode( "\n", file( 'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10035.txt' ) ); To: $rContents = implode( "\r\n", file( 'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10035.txt' ) ); If that doesn't work: To: $rContents = implode( "\n\r", file( 'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10035.txt' ) ); I can never remember the order :) Cheers, Rob. Simon Angell wrote: > > i removed a / and it worked :) > <?php > $rContents = implode( "\n", file( > 'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10035.txt' ) ); > > if( ($fp = fopen( 'test/canberratest.txt', 'w+' )) !== false ) > { > fputs( $fp, $rContents ); > fclose( $fp ); > } > ?> > > Now the format of the content is no longer, can this be fixed? > This is how it is originally. > IDN10035 > BUREAU OF METEOROLOGY > CANBERRA METEOROLOGICAL OFFICE > FORECAST FOR THE ACT > Issued at 3:34pm on Tuesday the 1st of October 2002 > > SITUATION: > > AND this is how the text file writes > IDN10035BUREAU OF METEOROLOGYCANBERRA METEOROLOGICAL OFFICEFORECAST FOR THE > ACTIssued at 3:34pm on Tuesday the 1st of October 2002SITUATION: > > with  all through it where a new line is suppose to be. > > Can this be fixed, or will i just need to work around it? > -- > 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. > > "Simon Angell" <seangell@iprimus.com.au> wrote in message > news:20021001171322.85344.qmail@pb1.pair.com... > > 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 | `----------------------------------------------'

« previous php.general (#118398) next »