Location: PHPKode > scripts > URL CSS Parser > url-css-parser/example.php
<?
/**
* 
* Example Code to show how to use the URL CSS PARSER
*
**/

include("urlcss.php");
if(!isset($_GET['u']))
{
   die("Enter URL through the address bar as \"...php?u=http://www.domainname.com\"");
}

/*
* This is the easiest way to quickly check up embedded CSS files in a URL.
* It prints the URL and lists all detected CSS files with direct link to the file
*/
echo <<< EOT
<pre><b>listCSSFiles()</b><br>
<i>This is the easiest way to quickly check up embedded CSS files in a URL.
It prints the URL and lists all detected CSS files with direct link to the file</i>
EOT;

$urlcss = new urlcss($_GET['u']);   // initialize the URL CSS Parser. $_GET['u'] can be any valid URL
$urlcss->listCSSFiles();            // will format and list all the embedded CSS files
echo "<br>----------------------------------------------------------------------<br>";





/*
* If you would like to get the CSS files as an array..
*/
echo <<< EOT
<b>getCSSArray()</b><br>
<i>Use this function if you would like to get the CSS files as an array 
(for individual manipulation later, perhaps?). The retrieved array is printed below</i>
EOT;
$arr = $urlcss->getCSSArray();
echo "<pre>". print_r($arr,1);
echo "<br>----------------------------------------------------------------------<br>";





/*
* if you would like to fetch the contents in a CSS file
*/
echo <<< EOT
<b>getCSSContent(full-path-to-css-file)</b><br> 
<i>Use this function for fetching the contents in a CSS file. This is a fairly simple function</i><br><br>.
EOT;
$cssContent = $urlcss->getCSSContent($arr[0]);
echo $cssContent;
echo "<br>----------------------------------------------------------------------<br>";
?>
Return current item: URL CSS Parser