File: /home/imensosw/public_html/imenso.co/dev/revspring/GetToken.php
<?php
/**
*
*/
class GetToken
{
public function generateToken()
{
$tokenUrl = "https://api.qua.truereg.care/patient-access/v1/oauth2/token";
$tokenHeaders = array(
'Content-Type: application/x-www-form-urlencoded'
);
$ch = curl_init($tokenUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $tokenHeaders);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials&client_id=9e6e7268-e327-4b23-9571-38170dd39ed5&client_secret=46220b5a-b444-41e0-9a8b-d931957515ea&scope=visits");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$tokenData = curl_exec($ch);
curl_close($ch);
return json_decode($tokenData, true);
}
}
?>