diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index 3aea124..a62671e 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -332,31 +332,31 @@ class HttpClient * @return bool|string * @throws Exception */ - private function matchHost($_string= '') + private function matchHost($_string = '') { if (empty($_string)) { return false; } if ($this->isHttp($_string)) { - $_= str_replace('http://', '', $_string); + $_ = str_replace('http://', '', $_string); $hostAndUrls = explode('/', $_string); $this->host = array_shift($hostAndUrls); - $_= implode('/', $hostAndUrls); + $_ = implode('/', $hostAndUrls); } else if ($this->isHttps($_string)) { - $_= str_replace('https://', '', $_string); + $_ = str_replace('https://', '', $_string); $this->setIsSSL(true); $hostAndUrls = explode('/', $_string); $this->host = array_shift($hostAndUrls); - $_= implode('/', $hostAndUrls); + $_ = implode('/', $hostAndUrls); } else if (empty($this->host)) { $hostAndUrls = explode('/', $_string); $this->host = array_shift($hostAndUrls); - $_= implode('/', $hostAndUrls); + $_ = implode('/', $hostAndUrls); } if (strpos($this->host, ':') !== false) { @@ -692,7 +692,9 @@ class HttpClient } if ($this->method === self::POST) { curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data)); + if (!is_string($data)) { + curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data)); + } } $output = curl_exec($ch);