You are here: Re: Need help getting text between tags « PHP Programming Language « IT news, forums, messages
Re: Need help getting text between tags

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>([^`]*?)&nbsp;<\/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>)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация