Jump to content


Photo

Get SOURCE code


  • Please log in to reply
1 reply to this topic

#1 summericeweb

summericeweb
  • New Members
  • Pip
  • Newbie
  • 6 posts
  • LocationBurlington

Posted 03 April 2006 - 03:17 AM

I need a function that will allow my to seach throught a file/webpage and get all of the style used.

Examples:
<style>[GET CODE]</style> and get
<Style type="text/css">[GET CODE]</style>


If any one could help it would be very nice. Thank you/
[a href="http://www.summericeweb.com/" target="_blank"]http://www.summericeweb.com/[/a] - the future of the web.

#2 Guest_footballkid4_*

Guest_footballkid4_*
  • Guests

Posted 03 April 2006 - 05:32 AM

<?php
$file = "urltoopen.php";
if ( $data = file( $file ) )
{
     $data = join( "\n" , $data );
     preg_match_all( "@<style[^>].+?>[^>](.*?)[^>]</style>@ism" , $data , $match );
     print_r( $match );
}
?>
Of course, that won't do much if they use an @import statement or a <link rel="stylesheet"...>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users