Wettmannstaetten impot update & ofaa oaid scripts
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/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 ";";
|
||||
echo "\n";
|
||||
}
|
||||
$page++;
|
||||
}
|
||||
Reference in New Issue
Block a user