Re: html parsing question

From: Date: Fri, 03 Aug 2001 03:51:37 +0000
Subject: Re: html parsing question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61075@lists.php.net to get a copy of this message
> Hi I have a question about parsing a page on another server to grab some > headlines. > > I want to search down the page until I find a string "-headlines-" then I > want to grab everything between the next pair of <table></table> tags. <?php # Untested code: $url = 'http://www.php.net', 'r'; $http = fopen($url, 'r') or die("$url not available."); $html = ''; while (!feof($http)){ $html .= fread($http, 1000000); } $parts = explode('-headlines-', $html); $headlines = $parts[1]; $parts = explode('<table>', $headlines); $table = $parts[1]; $parts = explode('</table>', $table); $table = $parts[0]; echo htmlentities($table); ?> -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#61075) next »