add clear
This commit is contained in:
@@ -27,6 +27,8 @@ class HttpClient
|
|||||||
|
|
||||||
private $port = 80;
|
private $port = 80;
|
||||||
|
|
||||||
|
private $_data = '';
|
||||||
|
|
||||||
const POST = 'post';
|
const POST = 'post';
|
||||||
const GET = 'get';
|
const GET = 'get';
|
||||||
const PUT = 'put';
|
const PUT = 'put';
|
||||||
@@ -40,6 +42,11 @@ class HttpClient
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setData($data)
|
||||||
|
{
|
||||||
|
$this->_data = $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -353,6 +360,9 @@ class HttpClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strtolower($this->method) == self::GET) {
|
if (strtolower($this->method) == self::GET) {
|
||||||
|
if (!empty($this->_data)) {
|
||||||
|
$client->setData($this->_data);
|
||||||
|
}
|
||||||
$client->get($url . '?' . $data);
|
$client->get($url . '?' . $data);
|
||||||
} else if (strtolower($this->method) == self::PUT) {
|
} else if (strtolower($this->method) == self::PUT) {
|
||||||
$client->setMethod('PUT');
|
$client->setMethod('PUT');
|
||||||
|
|||||||
Reference in New Issue
Block a user