Laravel/Guzzle Issue


Laravel/Guzzle Issue
Hello guys i have an issue when trying to use guzzle in laravel and i have spent ages trying to google it and research what the problem could be. This is a very simple get request for WHM/Cpanel api
$client = new Client();
$res = $client->request('GET', 'https://delta.cloudns.io:2087/json-api/accountsummary…', [
'auth' => [ 'username','passowrd']
]);
Now i get a 200 status for the request but i am not getting any data back and in the network tab on firefox/chrome tools the page is showing as a error 500.
The code above i put into the index of my controller. I have tested the username and password and url in postman and it works correctly and i get back the data i expect.
Any help would greatly appreciated. Thanks
passowrd
Thanks :) but no i just removed my username and password and mistyped password lol
– James Hayes
22 mins ago
1 Answer
1
Someone helped point me in the right direction. I should have been using $res->getBody()->getContents(); to get the data returned.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The typo in
passowrd
has nothing to do with it has it?– WebCode.ie
26 mins ago