Answers for "guzzle create post request with payload"

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
6

guzzle post request with data

$response = $client->request('POST', 'http://httpbin.org/post', [
    'form_params' => [
        'field_name' => 'abc',
        'other_field' => '123',
        'nested_field' => [
            'nested' => 'hello'
        ]
    ]
]);
Posted by: Guest on November-09-2020

Code answers related to "guzzle create post request with payload"

Browse Popular Code Answers by Language