add clear
This commit is contained in:
@@ -399,28 +399,31 @@ class HttpClient
|
|||||||
if (!empty($this->header)) {
|
if (!empty($this->header)) {
|
||||||
$client->setHeaders($this->parseHeaderMat());
|
$client->setHeaders($this->parseHeaderMat());
|
||||||
}
|
}
|
||||||
|
if (!empty($this->_data)) {
|
||||||
|
$client->setData($this->_data);
|
||||||
|
}
|
||||||
if (strtolower($this->method) == self::GET) {
|
if (strtolower($this->method) == self::GET) {
|
||||||
if (!empty($this->_data)) {
|
|
||||||
$client->setData($this->_data);
|
|
||||||
}
|
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
$url .= '?' . $data;
|
$url .= '?' . $data;
|
||||||
}
|
}
|
||||||
$client->get($url);
|
$client->get($url);
|
||||||
} else if (strtolower($this->method) == self::PUT) {
|
} else if (strtolower($this->method) == self::PUT) {
|
||||||
$client->setMethod('PUT');
|
$client->setMethod('PUT');
|
||||||
var_dump($data);
|
|
||||||
if (!is_string($data)) {
|
if (!is_string($data)) {
|
||||||
$data = json_encode($data);
|
$data = json_encode($data);
|
||||||
}
|
}
|
||||||
$client->setData($data);
|
if (!empty($data)) {
|
||||||
|
$client->setData($data);
|
||||||
|
}
|
||||||
$client->execute($url);
|
$client->execute($url);
|
||||||
} else if (strtolower($this->method) == self::DELETE) {
|
} else if (strtolower($this->method) == self::DELETE) {
|
||||||
$client->setMethod('DELETE');
|
$client->setMethod('DELETE');
|
||||||
if (!is_string($data)) {
|
if (!is_string($data)) {
|
||||||
$data = json_encode($data);
|
$data = json_encode($data);
|
||||||
}
|
}
|
||||||
$client->setData($data);
|
if (!empty($data)) {
|
||||||
|
$client->setData($data);
|
||||||
|
}
|
||||||
$client->execute($url);
|
$client->execute($url);
|
||||||
} else {
|
} else {
|
||||||
$client->post($url, $data);
|
$client->post($url, $data);
|
||||||
|
|||||||
Reference in New Issue
Block a user