Re: Newbie fopen() HELP..!
| From: | cdn | Date: | Fri, 25 Apr 2003 06:06:59 +0000 |
| Subject: | Re: Newbie fopen() HELP..! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145226@lists.php.net to get a copy of this message | ||
Hi
If I use the same code and put the txt file no the same server as the PHP
code is works perfectly but it is when i want a file from another server
"site" is does not work, but why ??.
I have read in the PHP manual under code eks. that somone there had the same
problem on a PHP ver 4.2.2 but no one has come up with a solution for the
problem. My provider is running ver 4.2.2 and is not changing to a newer
version.
So what do i do ????
Christian..
"Jennifer Goodie" <goodie@apollointeractive.com> wrote in message
news:NEBBIJJIKBGCCCNKMPBCKEPCHDAA.goodie@apollointeractive.com...
> I can't help woth the fopen, maybe you don't have the http protocol
> registered?
>
> Your assignments look funny. I don't think I've ever seen error
suppression
> in front of a variable before, it would make more sense to put it on the
> fread., and you are overwritting your variables the line after setting
them.
>
> This ...
>
> $WindStr = @fread($handle, 93);
> $WindStr .= @fread($handle, 5);
> $DirStr = @fread($handle, 5);
> $DirStr .= @fread($handle, 5);
>
> makes more sense to me.
>
> Also, shouldn't the ini)set be 1, not "On"?
>
> > -----Original Message-----
> > From: Christian.. [mailto:news@cdn.dk]
> > Sent: Thursday, April 24, 2003 3:15 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] Newbie fopen() HELP..!
> >
> >
> > Hi
> >
> > I am trying to start up a PHP site and i need som information from a
*.txt
> > file from another site but when i use "fopen" I get :
> >
> > "Warning: fopen(http://www.cdn.dk/test.txt, "r") - No such file
> > or directory
> > in
> > /customers/roskilderoklub.dk/roskilderoklub.dk/httpd.www/php/test1.php
on
> > line 7"
> > My code looks like this :
> >
> > <?php
> > $WindStr = '';
> > $DirStr = '';
> >
> > ini_set("allow_url_fopen", "On");
> >
> > $handle=fopen("http://www.cdn.dk/test.txt",
> > "r");
> > @$WindStr = fread($handle, 93);
> > @$WindStr = fread($handle, 5);
> > @$DirStr = fread($handle, 5);
> > @$DirStr = fread($handle, 5);
> >
> > @fclose($handle);
> >
> > echo "<p><font face='Verdana' size='1'
> > color='#007F7F'><br><br><b>Wind Speed
> > ".$WindStr." m/s
> > Dir
> > ".$DirStr."</b></font></p>";
> >
> > ?>
> >
> > The server is running PHP 4.2.2 could that be the problem ?
> > I have tryed alot but with out luck.
> > How do you get this PHP working ?.
> >
> > Christian...
> >
> >
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>