RE: [PHP] Retrieving text from a URL using PHP

From: Date: Thu, 06 Jun 2002 14:53:05 +0000
Subject: RE: [PHP] Retrieving text from a URL using PHP
Groups: php.general 
Request: Send a blank email to php-general+get-100937@lists.php.net to get a copy of this message
In theory, I would guess you could use combinations of explode and strstr to maybe explode on <, then run strstr on > so you get everything after the > but before the next <. Then you'd probably have to implode it or something. There might be a better way to do it with just substr and strstr so you don't have to explode it... There may be an easier way - but this is the first thing that popped into my head, and it might at least get you looking in a good direction. Good luck! -Natalie -----Original Message----- From: Anthony Ritter [mailto:tony@gonefishingguideservice.com] Sent: Thursday, June 06, 2002 11:44 AM To: php-general@lists.php.net Subject: [PHP] Retrieving text from a URL using PHP Is there any way to retrieve data (for example - the text *within* a table) from another URL so that only the text appears and not the html (tables, cells, colors, etc.) Below is a script which opens and reads a URL and then outputs the complete URL. I am just looking for the text output. Thank you in advance. Tony Ritter ....................................................................... <html> <head> <title>Retrieving text from a URL</title> </head> <body> <? $theurl="http://www.blah.com"; if (!($fp=fopen($theurl, "r"))) { echo "Could not open the URL"; exit; } $contents= fread($fp, 1000000); fclose($fp); echo "$contents"; echo "<br>"."This information retrieved from<br>"."<a href=\"$theurl\">$theurl</a><br>"."on ".(date("l jS F Y g:i a T")); ?> </body> </html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#100937) next »