@@ -90,7 +90,7 @@ public function __construct($config, $options = null)
9090 $ this ->http_response = 200 ;
9191 }
9292
93- public function exec ($ context , $ post_data = null ) {
93+ public function exec ($ context , $ post_data = null , $ custom_request = null ) {
9494 $ url = $ this ->host . $ this ->api_uri . '/ ' . preg_replace ('/\// ' , '' , $ context , 1 );
9595
9696 $ this ->log ->addDebug ("Curl $ url JsonData= " . $ post_data );
@@ -101,10 +101,20 @@ public function exec($context, $post_data = null) {
101101
102102 // post_data
103103 if (!is_null ($ post_data )) {
104- curl_setopt ($ ch , CURLOPT_POST , true );
105- curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ post_data );
104+ // PUT REQUEST
105+ if (!is_null ($ custom_request ) && $ custom_request == "PUT " ) {
106+ curl_setopt ($ curl , CURLOPT_CUSTOMREQUEST , "PUT " );
107+ curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ post_data );
108+ }
109+ if (!is_null ($ custom_request ) && $ custom_request == "DELETE " ) {
110+ curl_setopt ($ curl , CURLOPT_CUSTOMREQUEST , "DELETE " );
111+ }
112+ else {
113+ curl_setopt ($ ch , CURLOPT_POST , true );
114+ curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ post_data );
115+ }
106116 }
107-
117+
108118 curl_setopt ($ ch , CURLOPT_USERPWD , "$ this ->username : $ this ->password " );
109119
110120 curl_setopt ($ ch , CURLOPT_SSL_VERIFYHOST , $ this ->options [CURLOPT_SSL_VERIFYHOST ]);
0 commit comments