How to make a post request with GuzzleHttp( version 5.0 ).
I am trying to do the following:
$client = new \GuzzleHttp\Client();
$client->post(
'http://www.example.com/user/create',
array(
'email' => 'test@gmail.com',
'name' => 'Test user',
'password' => 'testpassword'
)
);
But I am getting the error:
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with the message 'No method can handle the email config key'
This method is now deprecated in 6.0. Instead of
body
useform_params
Try this
$client = new \GuzzleHttp\Client();
$client->post(
'http://www.example.com/user/create',
array(
'body' => array(
'email' => 'test@gmail.com',
'name' => 'Test user',
'password' => 'testpassword'
)
)
);