Guzzle 6 Post upgrade

Guzzle 6 Post upgrade

I recentely update my guzzle version from 3 to 6. The following call was working on 3 but now I need to upgrade it to 6 (as it is not working). After reading the docs, I am a little confused how this new post request works in Guzzle 6. Here is my OLD post request with Guzzle 3

 try
        {
            $request = $this->guzzleClient->post(
                '/login?token='.$this->container->getParameter("token"),
                array(),
                json_encode($data)
            );
            $request->setHeader('Content-Type', 'application/json');
            $response = $request->send();

            return $response->json();
        }

How do I transalate that so that it post the request?

Source: Symfony Questions

Leave a Reply

Your email address will not be published. Required fields are marked *