Re: Searching and removing
| From: | Justin Patrin | Date: | Thu, 29 Jul 2004 22:01:55 +0000 |
| Subject: | Re: Searching and removing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192248@lists.php.net to get a copy of this message | ||
On Thu, 29 Jul 2004 21:37:59 +0000 (UTC), Jonathan Lassoff
<jlassoff@gmail.com> wrote:
> There is a local radio station near me that has a crumby webserver that doesn't
> server HTTP requests in a standard way.
> So, I wrote a simple PHP script that fetches a playlist I want (with curl) and
> serves it properly. I only want to get a table from the resulting HTML file. I
> have it stored in a variable. So, my question is how would I go about removing
> the garbage I don't want until I hit the <table> tag I want and then remove
> everything after the </table> tag at the end?
>
Assuming there's only one table in the document....
preg_match('!<table[^>]*>.*</table>!i', $text, $matches);
$table = $matches[0];
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--