Re: Good HTML parser needed

From: Date: Tue, 13 May 2008 05:34:20 +0000
Subject: Re: Good HTML parser needed
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-274224@lists.php.net to get a copy of this message
On Tue, 2008-05-13 at 01:27 -0400, Robert Cummings wrote: > On Tue, 2008-05-13 at 12:28 +0800, Shelley wrote: > > Maybe I didn't use that tidy correctly. > > I don't want html, head, body things. Just parsed string. > > So strip them... > > <?php > // ... > > tidy_parse_string( $html ); > tidy_clean_repair(); > > $html = tidy_get_output(); > > $html = preg_replace( '#^.*<body>#Uis', '', $html ) > $html = preg_replace( '#</body>#Uis', '', $html ) > > //... > ?> Whoops... noticed some bugs there :B <?php $html = preg_replace( '#^.*<body>#Uis', '', $html ); $html = preg_replace( '#</body>.*$#Uis', '', $html ); ?> Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP

« previous php.general (#274224) next »