1 | <?php |
||
14 | class Guzzle6Transport implements TransportInterface |
||
15 | { |
||
16 | private ClientInterface $client; |
||
|
|||
17 | |||
18 | public function __construct(?ClientInterface $client = null) |
||
19 | { |
||
20 | $this->client = $client ?: new Client(); |
||
21 | } |
||
22 | |||
23 | public function executeRequest(string $uri, string $body): string |
||
24 | { |
||
25 | $request = new Request('POST', $uri, ['Content-Type' => 'application/x-www-form-urlencoded'], $body); |
||
26 | 1 | $response = $this->client->send($request); |
|
27 | |||
28 | 1 | return (string) $response->getBody(); |
|
29 | 1 | } |
|
30 | } |
||
31 |