/**
  * Make an HTTP request
  *
  * @return API results
  */
 function http($url, $method, $postfields = NULL, $authorization_header = false)
 {
     $this->http_info = array();
     $ci = curl_init();
     $headers = array('Expect:');
     curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
     curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
     curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
     curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
     curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
     curl_setopt($ci, CURLOPT_HEADER, FALSE);
     switch ($method) {
         case 'POST':
             curl_setopt($ci, CURLOPT_POST, TRUE);
             if ($authorization_header) {
                 $headers[] = $authorization_header;
             }
             if (!empty($postfields)) {
                 // print_r($postfields);
                 curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
             }
             break;
         case 'DELETE':
             curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
             if (!empty($postfields)) {
                 $url = "{$url}?{$postfields}";
             }
     }
     //  echo '<pre>';
     //print_r($headers);
     curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ci, CURLOPT_URL, $url);
     //  echo $url;
     $response = curl_exec($ci);
     $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
     if (!in_array($this->http_code, array(200, 201, 301))) {
         CWP_TOP_Core::addNotice("Connection error: " . htmlentities($response), 'error');
         return false;
     }
     $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
     $this->url = $url;
     curl_close($ci);
     if ($this->cache) {
         $this->cacheFile($response, $this->cache_file_name);
     }
     return $response;
 }