Open coscho opened 7 years ago
public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null) { self::$handle = curl_init();
if ($method !== Method::GET) { if ($method === Method::POST) { curl_setopt(self::$handle, CURLOPT_POST, true); } else { if ($method === Method::HEAD) { curl_setopt(self::$handle, CURLOPT_NOBODY, true); } curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method); } // to accept array http_build_query must me used curl_setopt(self::$handle, CURLOPT_POSTFIELDS, http_build_query($body)); } elseif (is_array($body)) { if (strpos($url, '?') !== false) { $url .= '&'; } else { $url .= '?'; } $url .= urldecode(http_build_query(self::buildHTTPCurlQuery($body))); }
This is a pretty critical issue.
public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null) { self::$handle = curl_init();