I am using Httpful to call an API that uses basic authentication headers.
Here is how my GET request is set up:
<?php
include('httpful.phar');
$uri = "https://example.com";
$response = \Httpful\Request::get($uri)
->addHeader('Authorization', 'Basic KEY')
->send();
echo $response;
?>
This works correctly and I am able to display the response data on my PHP page.
However, is this the most secure way to add headers using basic auth? Should I be placing the auth key into a separate file or something more secure?