| Posted by Andy C. on 04/26/06 01:31 
Baquanb@yahoo.com wrote:> I need to get some text between font tags but I only need the text in
 > the last table. The code i'm using below will get text between all font
 > tags anyone know how I can just get whats in TABLE3 font tags.
 >
 > $url = "http://www.mysite.com";
 > $data = implode("", file($url));
 > preg_match_all ("/<td>([^`]*?)<\/td>/", $data, $matches);
 >
 > foreach ($matches[0] as $match) {
 >
 > preg_match ("/<font>([^`]*?) <\/font>/", $match, $temp);
 > $text = $temp['1'];
 > $text= strip_tags($text);
 >
 > echo $text;
 >
 > }
 >
 
 One posibility is to give the font tags a css id or class then just
 include that in your preg_match statement. If table code is php
 generated then think about id'ing each font tage based on what table
 its in (i.e. <font id="table2">text</font>)
 [Back to original message] |