Skip to content

Instantly share code, notes, and snippets.

@sunny
Created May 12, 2010 09:20
Show Gist options
  • Save sunny/398371 to your computer and use it in GitHub Desktop.
Save sunny/398371 to your computer and use it in GitHub Desktop.
Apply the CSS styles to all the tags
<?php
function inlinestyler($html) {
return curl_post_data("http://inlinestyler.torchboxapps.com/styler/convert/", "returnraw=1&source=".urlencode($html));
}
function curl_post_data($uri, $data) {
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0); // do not return headers
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return the content of the call
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment