You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
561 B
PHTML
30 lines
561 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace Base\Tool;
|
||
|
|
||
|
use GuzzleHttp\Client;
|
||
|
|
||
|
class TaskClient
|
||
|
{
|
||
|
const SUCCESS = '0000';
|
||
|
|
||
|
protected $client;
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->client = new Client([
|
||
|
'base_uri' => C('TASK_URL'),
|
||
|
'timeout' => 5.0,
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
public function post($uri, $data)
|
||
|
{
|
||
|
$response = $this->client->post($uri, [
|
||
|
'verify' => false,
|
||
|
'form_params' => $data
|
||
|
]);
|
||
|
$result = (string)$response->getBody();
|
||
|
return json_decode($result, true);
|
||
|
}
|
||
|
}
|