Advertisement
cgrunwald

Untitled

Sep 16th, 2010
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1.     public static function HTMLMin($html)
  2.     {
  3.         $request = curl_init();
  4.         curl_setopt($request, CURLOPT_URL, "http://willpeavy.com/minifier/");
  5.         curl_setopt($request, CURLOPT_REFERER,"http://willpeavy.com/minifier/");
  6.         curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
  7.         curl_setopt($request, CURLOPT_HEADER, TRUE);
  8.         curl_setopt($request, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9");
  9.         curl_setopt($request, CURLOPT_POST, 1);
  10.         curl_setopt($request, CURLOPT_POSTFIELDS, 'html=' . urlencode($html));
  11.  
  12.         $reqResponse = curl_exec($request);
  13.         $s_parts = NULL;
  14.         if (preg_match('%<textarea id="html" name="html">(.*?)</textarea>%si', $reqResponse, $s_parts)) {
  15.             return urldecode($s_parts[1]);
  16.             curl_close($request);
  17.         }
  18.         return $reqResponse;
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement