PHP code example of xjtuana / cas-proxy-client

1. Go to this page and download the library: Download xjtuana/cas-proxy-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/ */

    

xjtuana / cas-proxy-client example snippets


use Xjtuana\Cas\ProxyClient\ClientV1;
use Xjtuana\Cas\ProxyClient\CasProxyClientException;

$client = new ClientV1([
    'protocol' => 'https',
    'hostname' => 'ana.xjtu.edu.cn',
    'prefix' => '/casproxy',
]);

try {
    $user = $client->login();
} catch(CasProxyClientException $e) {
    echo $e->getMessage();
}

echo $user;