Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Beispiel:

Code Block
languagephp
themeRDark
titleBeispiel in PHP (Alle Mitarbeiter anzeigen)
linenumberstrue
 <?php
$troiUsername = 'TROI_BENUTZER';
$troiPassword = 'TROI_PASSWORD';
$troiUrl = 'https://dh0014.troi.de/TROIPFAD/api/v2/rest/';

function curlGet($url){
	global $troiUsername, $troiPassword;
    if (!function_exists('curl_init')){
        die('Sorry cURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Troi API Example Client v0.1");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);     
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
    curl_setopt($ch, CURLOPT_USERPWD, $troiUsername . ":" . md5($troiPassword));
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}

$users = json_decode(curlGet($troiUrl.'employees?clientId=1'));

echo '<center><table><tr><td style="text-align; right; font-weight: bold; border-bottom: 2px black solid;">ID</td><td style="border-bottom: 2px black solid;">Name des Benutzers</td></tr>';

foreach ($users as $employee){
	echo '<tr><td style="text-align: right; font-weight: bold; border-bottom: 1px black solid">' . $employee->Id . '</td><td style="border-bottom: 1px black solid;">'. $employee->FullName . "</td></tr>";
};
echo "</table></center>"
?>

...

Tutorials von Panic

https://library.panic.com/statusboard/table_tutorial/

...