From dc513408092b6a726d30ce02b2cbe16b70bfbdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gotardo=20Gonz=C3=A1lez?= Date: Thu, 27 Feb 2014 17:53:09 +0100 Subject: [PATCH] Bugfix: If you make a GET request after a PUT request you still have the PUT value for CURLOPT_CUSTOMREQUEST, causing an error. I have forced CURLOPT_CUSTOMREQUEST to 'GET' on get requests to avoid header overriding. --- lib/Curl.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Curl.class.php b/lib/Curl.class.php index 029eed9..dd04295 100644 --- a/lib/Curl.class.php +++ b/lib/Curl.class.php @@ -46,6 +46,7 @@ class Curl { } public function get($url_mixed, $data=array()) { + $this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET'); if (is_array($url_mixed)) { $curl_multi = curl_multi_init(); $this->_multi_parent = true; @@ -90,6 +91,7 @@ class Curl { public function post($url, $data=array()) { $this->setOpt(CURLOPT_URL, $this->_buildURL($url)); + $this->setOpt(CURLOPT_CUSTOMREQUEST, 'POST'); $this->setOpt(CURLOPT_POST, true); $this->setOpt(CURLOPT_POSTFIELDS, $this->_postfields($data)); return $this->exec();