5

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
                            ]
                        ]);
2
  • I find it amazing that people use Guzzle vs cURL. The answer to that is something I'd like to see. Commented Sep 18, 2017 at 19:39
  • @BrianGottier oop. abstraction. This would be a valid question, by the way. Commented Sep 18, 2017 at 19:42

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.