51 lines
1.4 KiB
PHP
Executable File
51 lines
1.4 KiB
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");
|
|
}
|
|
}
|
|
//echo $access_token."\n";exit;
|
|
|
|
|
|
$headers[] = "Accept: application/json";
|
|
$headers[] = "Authorization: Bearer $access_token";
|
|
|
|
$page = 1;
|
|
while(1) {
|
|
$output = getRestUrl($ep_list_oaids, $headers, ["tenant"=> $tenant, "_page" => $page]);
|
|
if($output == "__err__401") {
|
|
$access_token = fetchAccessToken($oauth_url, $client_id, $client_secret, $default_scope);
|
|
$headers = [];
|
|
$headers[] = "Accept: application/json";
|
|
$headers[] = "Authorization: Bearer $access_token";
|
|
$output = getRestUrl($ep_list_oaids, $headers, ["tenant"=> $tenant, "_page" => $page]);
|
|
}
|
|
|
|
$output_values = json_decode($output);
|
|
if(!is_array($output_values) || !count($output_values)) {
|
|
/*echo "Leeres oder kein Json Array:";
|
|
echo $output."\n";*/
|
|
break;
|
|
}
|
|
|
|
if($page == 1) {
|
|
echo "ol_openaccessid;orig_externalid;orig_name\n";
|
|
}
|
|
|
|
foreach($output_values as $oaid_obj) {
|
|
echo $oaid_obj->oaid.";";
|
|
echo $oaid_obj->external_id.";";
|
|
echo ";";
|
|
if($oaid_obj->token != "confirmed") {
|
|
file_put_contents( "php://stderr", "; ".$oaid_obj->token );
|
|
}
|
|
echo "\n";
|
|
}
|
|
$page++;
|
|
}
|