Re: file() problems [newbie]
| From: | MVCS | Date: | Thu, 08 May 2003 02:41:39 +0000 |
| Subject: | Re: file() problems [newbie] | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146777@lists.php.net to get a copy of this message | ||
I got an idea from another post here, and changed changed
"http://weather.noaa.gov/blah/blah.txt"
to
http://205.156.51.200/blah/blah.txt" in
my file() function, and now its
working again... which doesn't necessarily mean anything, since it's tricked
me into thinking something i'd done had an effect a few times now, only to
start hanging again later.
being a newbie, i guess i should ask, is there anything inherently _wrong_
with this simple bit of code:
<?php
$weather = file ('http://weather.noaa.gov/blah/blah.txt');
echo $weather[0];
echo $weather[1];
echo $weather[2];
echo $weather[3];
?>
i like the file() as opposed to fopen or fgets or fread whatever, because
right off the bat i can have my array...
as always, posts/help/ideas are greatly appreciated.
thanks.
"Justin French" <justin@indent.com.au> wrote in message
news:BADFF241.2654B%justin@indent.com.au...
> Seems to me it'd be a networking problem, but it seems odd that the server
> hangs.
>
> Perhaps next time you get a hang, you could telnet into the BSD box, and
> attempt to ping the domain?
>
> <guess>It might also be something to do with file locking or restricting
> access on the file's server???</quote>
>
>
> Justin
>
>
>
> on 08/05/03 4:19 AM, MVCS (info@mesilla.com) wrote:
>
> > Trying some simple fopen() and file() on our FreeBSD machine
> > (php v4.0.6), and am running into the most irritating problem.
> >
> > When using file() to get a tiny remote text file (via HTTP), sometimes
the
> > damn thing works, and later on that day, it doesn't... no error though,
just
> > a never-ending hang. Sometimes it actually succeeds, after hanging for
2+
> > minutes...
> >
> > I know I should probably just set up a cron job to wget this text file,
but
> > this way really should work too:
> >
> > <?php
> >
> > $weather = file
> > ('http://a.small.four/line/textfile.txt');
> >
> > echo $weather[0];
> > echo $weather[1];
> > echo $weather[2];
> > echo $weather[3];
> >
> > ?>
> >
> > etc...
> >
> > I know it's an oversimplified example, but it _should_ work, and it
_does_
> > work, but then it wont work for a few hours, then it will...
> >
> > (the small text file is always present on the remote server, so that's
not
> > the issue)
> >
> > Comments? Help? Please? :)
> >
> >
>