Пример #1
0
 private function req($path, $params = array(), $gzip = false)
 {
     $url = self::$config['syncURLPrefix'] . $path;
     $params = array_merge(array("sessionid" => self::$sessionID, "version" => self::$config['apiVersion']), $params);
     if ($gzip) {
         $data = "";
         foreach ($params as $key => $val) {
             $data .= $key . "=" . urlencode($val) . "&";
         }
         $data = gzdeflate(substr($data, 0, -1));
         $headers = array("Content-Type: application/octet-stream", "Content-Encoding: gzip");
     } else {
         $data = $params;
         $headers = array();
     }
     $response = HTTP::post($url, $data, $headers);
     Sync::checkResponse($response);
     return $response;
 }