You are here: Re: Extract Content Between Style Tags with Preg and PHP « All PHP « IT news, forums, messages
Re: Extract Content Between Style Tags with Preg and PHP

Posted by ameshkin on 09/09/06 05:44

Holy shit it works...but, I will test this some more. What if there
is more than one instance of the style tag. Do i have to do something
like this?

foreach($match[0] as $div) {
echo $div;
}

and for the second one

foreach($match[1] as $div) {
echo $div;
}

I will experiment a little. If you can't tell, i only have about 6
months of PHP experience. Pretty much self taught. Thank yo sooo
much, you save dme hours of HORRIBLE regular expression reading and
figuring out!


Rik wrote:
> Rik wrote:
> > ameshkin wrote:
> >> This script I wrote works with tables, td's and div's, but not with
> >> style tags. Can anyone figure out the regular expression for finding
> >> <style> tags. The trick is that sometimes its not just <style> Its
> >> <style type="text/css">
> >>
> >> Basically, i want to take the information in between the style
> >> content from any url
> >>
> >
> > Well, for stasters it's closed with </style>, not <\style>....
> >
> >
> > preg_match_all('|<style[^>]*?>(.*?)</style>|si',$html,$matches);
>
> preg_match_all('|<style[^>]*>(.*?)</style>|si',$html,$matches);
> is better here...
>
> --
> Rik Wasmus

 

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

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