Exemple #1
0
<?php

require_once '../vendor/autoload.php';
session_start();
use GusApi\GusApi;
use GusApi\RegonConstantsInterface;
use GusApi\Exception\InvalidUserKeyException;
use GusApi\ReportTypes;
$gus = new GusApi('aaaaaabbbbbcccccdddd', new \GusApi\Adapter\Soap\SoapAdapter(RegonConstantsInterface::BASE_WSDL_URL, RegonConstantsInterface::BASE_WSDL_ADDRESS));
if (isset($_GET['reset'])) {
    $_SESSION = [];
    $_SESSION['checked'] = false;
}
if ($gus->serviceStatus() === RegonConstantsInterface::SERVICE_AVAILABLE) {
    try {
        if (!isset($_SESSION['sid']) || !$gus->isLogged($_SESSION['sid'])) {
            $_SESSION['sid'] = $gus->login();
            $_SESSION['checked'] = false;
        }
        if (isset($_POST['captcha'])) {
            $_SESSION['checked'] = $gus->checkCaptcha($_SESSION['sid'], $_POST['captcha']);
        }
        if (!$_SESSION['checked']) {
            $image = fopen("captcha.jpeg", 'w+');
            $captcha = $gus->getCaptcha($_SESSION['sid']);
            fwrite($image, base64_decode($captcha));
            fclose($image);
            printCaptchaForm();
        } else {
            printNipForm();
        }
Exemple #2
0
 /**
  * @expectedException GusApi\Exception\InvalidUserKeyException
  */
 public function testLoginInvalidKay()
 {
     $gus = new GusApi("abcdefghijklmnno");
     $sid = $gus->login();
 }