@johnconnet Have you verified this works using an HTTP client, like Postman? Start there and ensure it's working then come back to your code. Not knowing that endpoint, I'm not sure what else to suggest.
Jul 17, 2020
1
Level 1
Can t acess external API
So, i have the following code with guzzle to connect to an external API, with the domain "http://api.parksandrecreation.com/data/parks" and i also have an api_key (parksandrecreationapi)
function getAPIData() { $client = new client(); $res = $client->post( 'http://api.parksandrecreation.com/data/parks', ['auth' => ['api', 'parksandrecreationapi']] );
$contents = $res->getBody()->getContents();
var_dump(json_decode($contents));
}
so this function is on the controller, yet i can t acess it, giving me the following
object(stdClass)#286 (2) { ["success"]=> bool(false) ["message"]=> string(20) "Unauthorized request" }
can someone help me pls?
Please or to participate in this conversation.