I get my bearer token from an API end point and set the following:
$authorization = \"Bearer 080042cad6356ad5dc0a720c18b53b8e53d4c274\"
Nex
Guzzle example:
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
$token = 'your_token';
$httpClient = new Client();
$response = $httpClient->get(
'https://httpbin.org/bearer',
[
RequestOptions::HEADERS => [
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . $token,
]
]
);
print_r($response->getBody()->getContents());
See https://github.com/andriichuk/php-curl-cookbook#bearer-auth