Re: [PHP] Retrieving text from a URL using PHP
On Thursday 06 June 2002 23:43, Anthony Ritter wrote: 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.) strip_tags() -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Help stamp out Mickey-Mouse computer interfaces -- Menus are for Restaurants! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Retrieving text from a URL using PHP
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:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 11:44 AM To: [EMAIL PROTECTED] 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 titleRetrieving 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, 100); fclose($fp); echo $contents; echo br.This information retrieved frombr.a href=\$theurl\$theurl/abr.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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Retrieving text from a URL using PHP
I wish I'd seen this before I sent my message! -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 10:46 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Retrieving text from a URL using PHP On Thursday 06 June 2002 23:43, Anthony Ritter wrote: 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.) strip_tags() -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Help stamp out Mickey-Mouse computer interfaces -- Menus are for Restaurants! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving text from a URL using PHP
Thank you Jason. I'm still trying to figure out how to implement the strip_tags() function on the script below so that the output of the URL is straight text. Please advise if you get a chance. TR . html head titleRetrieving 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, 100); fclose($fp); echo $contents; echo br.This information retrieved frombr.a href=\$theurl\$theurl/abr.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
Re: [PHP] Retrieving text from a URL using PHP
echo strip_tags($contents); miguel On Thu, 6 Jun 2002, Anthony Ritter wrote: I'm still trying to figure out how to implement the strip_tags() function on the script below so that the output of the URL is straight text. Please advise if you get a chance. TR . html head titleRetrieving 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, 100); fclose($fp); echo $contents; echo br.This information retrieved frombr.a href=\$theurl\$theurl/abr.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
Re: [PHP] Retrieving text from a URL using PHP
Thanks Miguel! TR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php