Sander Akkerman
Sander Akkerman

Reputation: 53

GuzzleHTTP how to get Request Header

I want to print out the request header of a POST request, but I can't find the answer by searching the web. Can someone explain how to do this?

I have this array that I pass in the POST request as $value. I want to see how it's parsed in the GuzzleHTTP POST request.

Array example

Array
(
    [username] => admin

    [password] => pass

    [submit] => login

)

$client->request('POST', $url, [
                            'form_params' => [
                                $value
                            ]
                        ]);

Upvotes: 5

Views: 7153

Answers (1)

Calimero
Calimero

Reputation: 4308

You should enable debug output, like so :

$client->request('POST', $url, ['form_params' => [$value], 'debug' => true]);

Source & doc : http://docs.guzzlephp.org/en/stable/request-options.html#debug

Upvotes: 4

Related Questions