1

anyone has an idea why this works in postman but not in Guzzle?

Settings in Postman

In Guzzle i use to send the data as form_params and headers. I receive status 200 but NULL as response.

    $response = $client->post('https://api.host.com/v2/tokens', [
        'headers' => ['Content-Type' => 'application/json'],
        'debug' => true,
        'form_params' => [
            'grant_type' => 'password',
            'username' => 'my@email.com',
            'password' => 'secret'
        ]
    ]);

I also try to send the data as body json but will no success too.

    'body' => json_encode([
        'grant_type' => 'password',
        'username' => 'my@email.com',
        'password' => 'secret'
    ])

Can anyone help?

double-beep
  • 5,031
  • 17
  • 33
  • 41
penny
  • 13
  • 3

0 Answers0