| 
	
 | 
 Posted by Baquanb on 04/26/06 00:08 
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; 
 
} 
 
TABLE1 
<table> 
<td> 
<font>text1</font> 
<b>something</b> 
</td> 
<td> 
<font>text2</font> 
<b>something</b> 
</td> 
<td> 
<font>text3</font> 
<b>something</b> 
</td> 
</table> 
 
TABLE2 
<table> 
<td> 
<font>text4</font> 
<b>something</b> 
</td> 
<td> 
<font>text5</font> 
<b>something</b> 
</td> 
<td> 
<font>text6</font> 
<b>something</b> 
</td> 
</table> 
 
TABLE3 
<table> 
<td> 
<font>text7</font> 
<b>something</b> 
</td> 
<td> 
<font>text8</font> 
<b>something</b> 
</td> 
<td> 
<font>text9</font> 
<b>something</b> 
</td> 
<td> 
<font>text10</font> 
<b>something</b> 
</td> 
</table>
 
  
Navigation:
[Reply to this message] 
 |