RE: [PHP] Remote Files using PHP: Help Please
| From: | John Holmes | Date: | Sun, 15 Sep 2002 18:46:13 +0000 |
| Subject: | RE: [PHP] Remote Files using PHP: Help Please | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116461@lists.php.net to get a copy of this message | ||
Here, this will get the data table for you. Adapt to your needs:
<?
$fp =
fopen("http://waterdata.usgs.gov/ny/nwis/current?type=sw&group_key=huc_c
d&search_site_no_station_nm=01427510","r");
$content = fread($fp,100000);
eregi("<!-- start of data table -->(.*)<HR>",$content,$match);
echo $match[1];
?>
This depends on them not changing the layout of the page, too.
---John Holmes...
> -----Original Message-----
> From: Anthony Ritter [mailto:tony@gonefishingguideservice.com]
> Sent: Sunday, September 15, 2002 3:31 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Remote Files using PHP: Help Please
>
> John,
> If you were to take a look at that page from the USGS site - is it
even
> possible using php regexp functions to filter the data just to return
that
> particular record?
>
> If so, I'm looking for an online tutorial.
>
> Many thanks.
> TR
> ....................................
>
> John Holmes wrote in message:
>
> > No, you have to read the whole file, and then filter out what you
need
> > on your side. This is where you would use regular expressions.
> >
> > Also, be aware of any copyright violations you may be committing, or
you
> > could just contact the owner of the page and ask for access to this
> > data. Maybe they'll set up some kind of XML feed for you.
> >
> > ---John Holmes...
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php