You are here

function _minify_send_request in Minify 7

Helper function to send CURL request

1 call to _minify_send_request()
_minify_process_minify in ./minify.admin.inc
Helper function to process minify call

File

./minify.admin.inc, line 287

Code

function _minify_send_request($post_data) {
  if (function_exists('curl_init')) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "https://closure-compiler.appspot.com/compile");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($curl, CURLOPT_POST, true);
    $response = json_decode(curl_exec($curl));
    $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);
    return array(
      'response' => $response,
      'http_code' => $httpcode,
    );
  }
}