PHP code example of banalitoraulito / simplysign

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

    

banalitoraulito / simplysign example snippets


use Webinv\SimplySign\Client\Authorization;

$client = new Authorization($connection);
$redirectUrl = 'http://example.com/02-authorization-grant-token.php';

if (isset($_GET['code'])) {
    $token = $client->getAccessTokenByAuthorizationCode($redirectUrl, $_GET['code']);
    print_r($token);
} else {
    header(sprintf('Location: %s', $client->getAuthorizationUrl($redirectUrl)));
}

use Webinv\SimplySign\Connection;
use Webinv\SimplySign\Client\SoftCardService;

$connection = new Connection([
    'client_id' => '**client_id**',
    'client_secret' => '**client_secret**',
    'domain' => Connection::DOMAIN_TEST
]);

$client = new SoftCardService($connection);

$token = new \Webinv\SimplySign\Model\Token([
    'access_token' => '*******************************************',
    'token_type' => 'bearer',
    'expires_in' => 7200,
    'refresh_token' => '*******************************************'
]);

$certificates = $client->getCertificates('**card***', $token);
foreach ($certificates as $certificate) {
    echo 'File: ' . $certificate->getFilename() . "\n\n";
    echo $certificate->getContent() . "\n\n";
}