html stripping
| From: | php-general at mccullough-net dot com | Date: | Thu, 04 Dec 2003 15:25:38 +0000 |
| Subject: | html stripping | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171837@lists.php.net to get a copy of this message | ||
No this is not some shaddy game or strip poker knock-off. My question has to
do with a person project I have started. I have a script that grabs names and
ids from a database, puts them in an array and then based on that grabs a URL
and parses that URL for this name, drops all the html crap, and takes the
information/stats and insert or updates the stats table. Problem is on
certain names the page that it is parsing is different, and so I get loads and
loads of extra HTML, and one name in particular doesnt return all the stats.
More detail is:
###################################################################
CODE
$start=$name;
$end='</td></tr>';
$start_position=strpos($myLine, $start);
$end_position=strpos($myLine, $end)+strlen($end);
$length=$end_position-$start_position;
$myLine=substr($myLine, $start_position, $length);
$myLine=str_replace("</a>","",$myLine);
$myLine=str_replace("</td><td
class='content'>","|",$myLine);
$stats=explode("|", $myLine);
############################################################################
I write all this to log what it is getting back and that is how I know that
basically on some of these names its return the full page.
I'm really at a loss, anyone have any ideas?
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/