| @@ 143-178 (lines=36) @@ | ||
| 140 | curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file)); |
|
| 141 | } |
|
| 142 | ||
| 143 | switch($method) { |
|
| 144 | case 'DELETE': |
|
| 145 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
| 146 | ||
| 147 | if (isset($body)) { |
|
| 148 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
|
| 149 | } |
|
| 150 | break; |
|
| 151 | case 'DELETEARRAY': |
|
| 152 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
| 153 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 154 | break; |
|
| 155 | case 'PUT': |
|
| 156 | //$jfile=json_encode($body); echo $jfile; die(""); |
|
| 157 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); |
|
| 158 | if (isset($query)) { |
|
| 159 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 160 | } |
|
| 161 | ||
| 162 | if (isset($body)) { |
|
| 163 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
|
| 164 | } |
|
| 165 | break; |
|
| 166 | case 'POST': |
|
| 167 | if (isset($query)) { |
|
| 168 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 169 | } |
|
| 170 | ||
| 171 | //echo json_encode($body); die(""); |
|
| 172 | if (isset($body)) { |
|
| 173 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
|
| 174 | } |
|
| 175 | break; |
|
| 176 | case 'ADD': |
|
| 177 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
|
| 178 | } |
|
| 179 | ||
| 180 | $result = curl_exec($ch); |
|
| 181 | //var_dump($result); die(""); |
|
| @@ 229-264 (lines=36) @@ | ||
| 226 | ||
| 227 | curl_setopt_array($ch, $curlOpts); |
|
| 228 | ||
| 229 | switch($method) { |
|
| 230 | case 'DELETE': |
|
| 231 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
| 232 | ||
| 233 | if (isset($body)) { |
|
| 234 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
|
| 235 | } |
|
| 236 | break; |
|
| 237 | case 'DELETEARRAY': |
|
| 238 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
| 239 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 240 | break; |
|
| 241 | case 'PUT': |
|
| 242 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); |
|
| 243 | if (isset($query)) { |
|
| 244 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 245 | } |
|
| 246 | ||
| 247 | if (isset($body)) { |
|
| 248 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
|
| 249 | } |
|
| 250 | break; |
|
| 251 | case 'POST': |
|
| 252 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
|
| 253 | if (isset($query)) { |
|
| 254 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 255 | } |
|
| 256 | ||
| 257 | if (isset($body)) { |
|
| 258 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
|
| 259 | } |
|
| 260 | break; |
|
| 261 | case 'ADD': |
|
| 262 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
|
| 263 | } |
|
| 264 | ||
| 265 | $result = curl_exec($ch); |
|
| 266 | ||
| 267 | $isxml=FALSE; |
|