Merge branch 'master' of github.com:Mashape/unirest-php

This commit is contained in:
thefosk
2014-01-14 10:29:19 -08:00
2 changed files with 20 additions and 3 deletions

View File

@@ -171,9 +171,13 @@
$ch = curl_init();
if ($httpMethod != HttpMethod::GET) {
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $httpMethod);
Unirest::http_build_query_for_curl($body, $postBody);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postBody);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $httpMethod);
if( is_array($body) || $body instanceof Traversable ) {
Unirest::http_build_query_for_curl($body, $postBody);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postBody);
} else {
curl_setopt ($ch, CURLOPT_POSTFIELDS, $body);
}
} else if (is_array($body)) {
if (strpos($url,'?') !== false) {
$url .= "&";