Search code examples
jsonlaravelputguzzle

Guzzle : Send JSON using PUT method


I want to update a Group so I use the put method to send json p.e. {"admin":1,"user":0}.

$response = $this->_client->put("http://10.10.10.10.xip.io/groups/29")->send();

I've tried to add it to the url but with no luck. I can't seem to grab it in my back-end. Keep in mind i'm using Laravel for the back. Thanks in advance guys.


Solution

  • Guzzle :

    $this->_client
         ->put($this->_requestUrl, array(), json_encode($this->_restObject))
         ->send();
    

    Laravel

    Input::json()->all()