Пример #1
0
 public static function delete($url, array $headers = array(), $headers_only = false, array $curl_options = array())
 {
     //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
     $ch = RESTRequest::factory($curl_options);
     $ch->set_opt(CURLOPT_URL, $url)->set_opt(CURLOPT_RETURNTRANSFER, true)->set_opt(CURLOPT_NOBODY, $headers_only)->set_opt(CURLOPT_CUSTOMREQUEST, 'DELETE');
     //Set any additional headers
     if (!empty($headers)) {
         $ch->set_opt(CURLOPT_HTTPHEADER, $headers);
     }
     $result['content'] = $ch->exec();
     $result['http_code'] = self::$http_code;
     return new RESTResponse($result);
 }