add clear
This commit is contained in:
@@ -681,22 +681,13 @@ class HttpClient
|
|||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->method != self::GET && !empty($this->_data)) {
|
|
||||||
$this->_data = $this->mergeParams($data);
|
|
||||||
} else {
|
|
||||||
$this->_data = $this->mergeParams($data);
|
|
||||||
}
|
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));
|
||||||
|
if ($this->method === self::GET && !empty($this->_data)) {
|
||||||
if (!is_string($this->_data)) {
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->toRequest($data));
|
||||||
$message = $this->header['Content-Type'] ?? $this->header['content-type'] ?? 'application/json';
|
}
|
||||||
if ($message == 'application/json') {
|
if ($this->method === self::POST) {
|
||||||
$this->_data = json_encode($this->_data, JSON_UNESCAPED_UNICODE);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data));
|
||||||
} else {
|
|
||||||
$this->_data = http_build_query($this->_data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_data);
|
|
||||||
|
|
||||||
$output = curl_exec($ch);
|
$output = curl_exec($ch);
|
||||||
if ($output === false) {
|
if ($output === false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user