PHP code example of everlutionsk / citadel-client

1. Go to this page and download the library: Download everlutionsk/citadel-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

everlutionsk / citadel-client example snippets




itadelClient\HttpClient;
use CitadelClient\SessionResolveRequest;

// Initialize the HTTP client
$client = new HttpClient('https://api.citadel.example', 'your-pre-shared-key');

// Prepare the session resolve request
$request = new SessionResolveRequest('your-cookie-header', 'your-client-id', 'your-client-secret');

try {
    // Resolve the session
    $response = $client->sessionResolve($request);

    // Handle the response
    if ($response->session) {
        echo "Session resolved successfully:\n";
        echo "Session ID: " . $response->session->id . "\n";
        // Other session details...
    } else {
        echo "No session resolved.\n";
        echo "Recommended action: " . $response->recommended->action . "\n";
        // Other recommendations...
    }
} catch (\Exception $e) {
    // Handle errors
    echo "Error: " . $e->getMessage() . "\n";
}