diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index b0448e3..6c1688d 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -666,7 +666,11 @@ class HttpClient } curl_setopt($ch, CURLOPT_HEADER, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, $this->parseHeaderMat()); + + $headers = $this->parseHeaderMat(); + if (!empty($headers) && is_array($headers)) { + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + } curl_setopt($ch, CURLOPT_USERAGENT, $this->agent); if (file_exists($cert = $this->getSslCertFile())) { diff --git a/wchat/officialaccount/Authorization.php b/wchat/officialaccount/Authorization.php index 2fb4675..90899df 100644 --- a/wchat/officialaccount/Authorization.php +++ b/wchat/officialaccount/Authorization.php @@ -42,6 +42,7 @@ class Authorization extends AfficialAccount $requestParam['lang'] = 'zh_CN'; $client = HttpClient::NewRequest(); + $client->setUseSwoole($this->getConfig()->isUsrSwoole()); $result = $client->get($this->snsUserInfo, $requestParam); if ($result->isResultsOK()) { return $result; @@ -65,6 +66,7 @@ class Authorization extends AfficialAccount $requestParam['grant_type'] = 'authorization_code'; $client = HttpClient::NewRequest(); + $client->setUseSwoole($this->getConfig()->isUsrSwoole()); return $client->get($this->oauth2, $requestParam); }