Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guzzle client in Laravel: InvalidArgumentException: "No method is configured to handle the form_params config key"

I am trying to use Guzzle client to post requests to an API, and I am getting an error message saying,

InvalidArgumentException: "No method is configured to handle the form_params config key"

This is what I have tried:

$response = $this->guzzle->post("https://example.com",[
                'form_params'=> [
                    'client_id'=>$this->client_id,
                    'authorization_code'=>$this->authorization_code,
                    'decoder_query'=> $this->requestQuery
                  ],
            ]
        );

$this->requestQuery is a JSON request.

like image 695
Bhargav Patel Avatar asked Nov 27 '25 01:11

Bhargav Patel


1 Answers

$response = $this->guzzle->post("https://example.com", [
    'body' => [
        'client_id'         => $this->client_id,
        'authorization_code'=> $this->authorization_code,
        'decoder_query'     => json_encode($this->requestQuery),
    ]
]);

with this syntax I am getting it woking..

like image 112
Bhargav Patel Avatar answered Nov 29 '25 15:11

Bhargav Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!