cURL works for my REST API but Guzzle not
There's no need to have the square brackets around the body
value. Also, make sure there is an Accept
header defined. You should use this instead:
$response = GuzzleHttp\post('http://www.example.com:1234/rest/user/validat', [
'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'],
'body' => '{"email":"[email protected]", "pwd":"xxxxxx"}'
]);
print_r($response->json());
This way it works
'Accept' => '*/*'
Good luck!