@@ -47,7 +47,7 @@ public function __construct() {
4747
4848 public function get ($ url , $ data = array ()) {
4949 if (count ($ data ) > 0 )
50- $ this ->setopt (CURLOPT_URL , $ url . '? ' g . http_build_query ($ data ));
50+ $ this ->setopt (CURLOPT_URL , $ url . '? ' . http_build_query ($ data ));
5151 else
5252 $ this ->setopt (CURLOPT_URL , $ url );
5353 $ this ->setopt (CURLOPT_HTTPGET , TRUE );
@@ -57,40 +57,27 @@ public function get($url, $data = array()) {
5757 public function post ($ url , $ data =array ()) {
5858 $ this ->setopt (CURLOPT_URL , $ url );
5959 $ this ->setopt (CURLOPT_POST , TRUE );
60- if (is_array ($ data )){
61- $ data = http_build_query ($ data );
62- }
60+ $ data = http_build_query ($ data );
6361 $ this ->setopt (CURLOPT_POSTFIELDS , $ data );
6462 $ this ->_exec ();
6563 }
6664
6765 public function put ($ url , $ data =array ()) {
68- $ this ->setopt (CURLOPT_URL , $ url );
66+ $ this ->setopt (CURLOPT_URL , $ url . ' ? ' . http_build_query ( $ data ) );
6967 $ this ->setopt (CURLOPT_CUSTOMREQUEST , 'PUT ' );
70- if (is_array ($ data )){
71- $ data = http_build_query ($ data );
72- }
73- $ this ->setopt (CURLOPT_POSTFIELDS , $ data );
7468 $ this ->_exec ();
7569 }
7670
7771 public function patch ($ url , $ data =array ()) {
7872 $ this ->setopt (CURLOPT_URL , $ url );
7973 $ this ->setopt (CURLOPT_CUSTOMREQUEST , 'PATCH ' );
80- if (is_array ($ data )){
81- $ data = http_build_query ($ data );
82- }
83- $ this ->setopt (CURLOPT_POSTFIELDS , $ data );
74+ $ this ->setopt (CURLOPT_POSTFIELDS , $ data );
8475 $ this ->_exec ();
8576 }
8677
8778 public function delete ($ url , $ data =array ()) {
88- $ this ->setopt (CURLOPT_URL , $ url );
79+ $ this ->setopt (CURLOPT_URL , $ url . ' ? ' . http_build_query ( $ data ) );
8980 $ this ->setopt (CURLOPT_CUSTOMREQUEST , 'DELETE ' );
90- if (is_array ($ data )){
91- $ data = http_build_query ($ data );
92- }
93- $ this ->setopt (CURLOPT_POSTFIELDS , $ data );
9481 $ this ->_exec ();
9582 }
9683
0 commit comments