need help with preg_match
| From: | joe | Date: | Sat, 08 Feb 2003 16:21:04 +0000 |
| Subject: | need help with preg_match | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134877@lists.php.net to get a copy of this message | ||
Hi
I have to alter this code:
<?php
$fp = fopen ('http://www.whatever.ee/',
'r');
for ($src = ''; !feof ($fp); $src .= fgets ($fp, 1024));
fclose ($fp);
if (preg_match ('/\<font color=black\>([^<]*)\<\/font>/i', $src, $matches))
echo 'Match: <b>'.$matches[1].'</b>';
else
echo 'No match !';
?>
It extracts the data (words) from www.whatever.com between <font=black> and
</font>.
It works well if the source looks something like this:
<font=black>text</font> (it echos "text")
but i am having some serious problems when the source looks like
this<table><font=black><tr>text</tr></font></table>. It wont do
anything if
it is supposed to echo html. but i need html!
Could somebody help me change the script so that it can extract html as
well?
If you can, mail me at liberache@hot.ee or just reply here....
Thank You!