PHP code example of spazzmarticus / e-css-tractor

1. Go to this page and download the library: Download spazzmarticus/e-css-tractor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spazzmarticus / e-css-tractor example snippets


//Your HTML-Document with one or more <style>-Tags
$html = '<html><head><style>p { color: blue; }</style></head>...<style>h1 { background-color: green; }</style></html>'; 
$eCSStractor = new eCSStractor();
$css = $eCCStractor->extract($html);

header("Content-type: text/css");
echo $css;