34 lines
792 B
PHP
Executable File
34 lines
792 B
PHP
Executable File
#!/usr/bin/php
|
|
<?php
|
|
require_once __DIR__."/include/config.php";
|
|
require_once __DIR__."/include/rest.php";
|
|
|
|
|
|
if(!$access_token) {
|
|
$access_token = fetchAccessToken($oauth_url, $client_id, $client_secret, $default_scope);
|
|
if(!$access_token) {
|
|
die("Error getting access token");
|
|
}
|
|
}
|
|
|
|
$headers = [
|
|
"Authorization: Bearer $access_token",
|
|
"Accept: application/json",
|
|
];
|
|
|
|
$content = [
|
|
"version" => "v8",
|
|
"external_id" => guidv4()
|
|
];
|
|
|
|
$output = getRestUrl($ep_mgm_credits, $headers);
|
|
if($output == "__err__401") {
|
|
$access_token = fetchAccessToken($oauth_url, $client_id, $client_secret, $default_scope);
|
|
$headers = [
|
|
"Authorization: Bearer $access_token",
|
|
"Accept: application/json",
|
|
];
|
|
$output = getRestUrl($ep_mgm_credits, $headers);
|
|
}
|
|
var_dump($output);exit;
|