Re: Extracting data from a URL using PHP
| From: | Scott Pier | Date: | Thu, 13 Jun 2002 22:16:22 +0000 |
| Subject: | Re: Extracting data from a URL using PHP | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-14208@lists.php.net to get a copy of this message | ||
Tony,
You should be able to extract the section you want if there is something
specific about that section. For example if that table has a name=, id= or
the width is different from the other tables, etc... I have done this, I am
sure there is an easier way but here is what I did...
<CODE>
// Open website
$fp=@fopen("http://www.TheURL.com/ThePage.asp?ID=".$id,
"r") or die("Die
Message.");
// Read website into $read
$read=fread($fp, 15000);
// Close the channel
fclose($fp);
// Select the region of the site to work with.
$search = eregi("<table width=\"542\" border=\"0\"
cellspacing=\"0\"
cellpadding=\"0\">(.*)</table>", $read, $printing);
</CODE>
I then put the table back in when I printed the string.
I hope this helps,
Scott
"Anthony Ritter" <tony@gonefishingguideservice.com> wrote in message
news:20020607013546.96867.qmail@pb1.pair.com...
>
> Is there any way to extract *specific* data off a page - like text within
> one table (if there were four separate html tables on that page) - while
> leaving the balance of the text and the other tables alone?
>
> Thank you.
> Tony Ritter
>
>
>
>
>
>
>
>
>