Using Guzzle, I'm consuming some external apis in JSON format, usually I get the data with
$data = $request->getBody()->getContents();
But i can't get data from this different api. It seems the data doesn't come in a 'Response Body'.
This api call works: https://i.ibb.co/80Yk6dx/Screenshot-2.png
This doesn't work: https://i.ibb.co/C239ghy/Screenshot-3.png
public function getRemoteCienciaVitaeDistinctions()
{
$client = new Client(['headers' => ['Accept' => 'application/json']]);
$request = $client->get(
'https://................/',
[
'auth' => ['...', '...'],
]
);
$data = $request->getBody()->getContents();
return $data;
}
$request->getBody()->getContents()
and what should actually return ? – Supun Praneethhttps://reqres.in/api/products/3
this is return sample json code. remove your auth – Supun Praneeth