Skip to content

Commit efbc9d2

Browse files
committed
Return error code when calling get, post, put, patch, and delete methods
1 parent 8d20237 commit efbc9d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Curl.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,33 @@ public function __construct() {
3838
public function get($url, $data=array()) {
3939
$this->setopt(CURLOPT_URL, $url . '?' . http_build_query($data));
4040
$this->setopt(CURLOPT_HTTPGET, TRUE);
41-
$this->_exec();
41+
return $this->_exec();
4242
}
4343

4444
public function post($url, $data=array()) {
4545
$this->setopt(CURLOPT_URL, $url);
4646
$this->setopt(CURLOPT_POST, TRUE);
4747
$this->setopt(CURLOPT_POSTFIELDS, $this->_postfields($data));
48-
$this->_exec();
48+
return $this->_exec();
4949
}
5050

5151
public function put($url, $data=array()) {
5252
$this->setopt(CURLOPT_URL, $url . '?' . http_build_query($data));
5353
$this->setopt(CURLOPT_CUSTOMREQUEST, 'PUT');
54-
$this->_exec();
54+
return $this->_exec();
5555
}
5656

5757
public function patch($url, $data=array()) {
5858
$this->setopt(CURLOPT_URL, $url);
5959
$this->setopt(CURLOPT_CUSTOMREQUEST, 'PATCH');
6060
$this->setopt(CURLOPT_POSTFIELDS, $data);
61-
$this->_exec();
61+
return $this->_exec();
6262
}
6363

6464
public function delete($url, $data=array()) {
6565
$this->setopt(CURLOPT_URL, $url . '?' . http_build_query($data));
6666
$this->setopt(CURLOPT_CUSTOMREQUEST, 'DELETE');
67-
$this->_exec();
67+
return $this->_exec();
6868
}
6969

7070
public function setBasicAuthentication($username, $password) {

0 commit comments

Comments
 (0)