Skip to content

Commit

Permalink
fix PUT and DELETE request
Browse files Browse the repository at this point in the history
  • Loading branch information
Prasetyo Wicaksono committed Feb 7, 2014
1 parent 504b347 commit c23e3d5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/RestClient/CurlRestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ public function executeQuery($url, $method = 'GET', $header = array(), $data = a
curl_setopt($curl, CURLOPT_POSTFIELDS, array());
}
} elseif ($method == 'PUT') {
curl_setopt($curl, CURLOPT_PUT, true);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
} else {
curl_setopt($curl, CURLOPT_POSTFIELDS, array());
}
} elseif ($method == 'DELETE') {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
} else {
Expand Down

0 comments on commit c23e3d5

Please sign in to comment.