Answers for "guzzle client json body"

PHP
0

guzzlehttp post json example

use GuzzleHttp\Client;

$client = new Client();

$response = $client->post('url', [
    GuzzleHttp\RequestOptions::JSON => ['foo' => 'bar'] // or 'json' => [...]
]);
Posted by: Guest on April-14-2021
0

php convert guzzle response to json

$response = GuzzleHttp\get('http://httpbin.org/get');
if ($response->getBody()) {
    echo $response->getBody();
    // JSON string: { ... }
}
Posted by: Guest on August-12-2020

Browse Popular Code Answers by Language