PHP code example of csoellinger / php-fon-webservices

1. Go to this page and download the library: Download csoellinger/php-fon-webservices 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/ */

    

csoellinger / php-fon-webservices example snippets




$tId = 'abcd45678'; // FinanzOnline Teilnehmer-ID
$tUid = 'abcd45678'; // FinanzOnline Teilnehmer-UID (if available, otherwise leave blank)
$benId = 'abcd45678'; // FinanzOnline Benutzer-ID
$benPin = 'abcd45678'; // FinanzOnline Benutzer-PIN

$credential = new FonCredential($tId, $tUid, $benId, $benPin);

// Initialize
$sessionWs = new SessionWs($credential);

// Login
$sessionWs->login();

// Get session id
$sessionId = $sessionWs->getID();

// optional: logout. Not really needed cause you will be logged off at class destruct.
$sessionWs->logout();

// Initialize with previous created session webservice

/** @var SessionWs $sessionWs */
$checkVatIdWs = new VatIdCheckWs($sessionWs);

// Check at level one only returns valid
var_dump($checkVatIdWs->check('ATU36975500'));
/**
 * CSoellinger\FonWebservices\Result\VatIdCheck\ValidLevelOne
 *   valid => (bool) true
 */

// At level two you also get name and address of the organisation if available
var_dump($checkVatIdWs->check('ATU36975500', 2));
/**
 * CSoellinger\FonWebservices\Result\VatIdCheck\ValidLevelTwo
 *   name => (string) 'McDonald's Franchise GmbH'
 *   address => (string) 'Campus 21,Liebermannst A01601 AT-2345 Brunn am Gebirge'
 *   valid => (bool) true
 */

// Initialize with previous created session webservice

/** @var SessionWs $sessionWs */
$databoxDownloadWs = new DataboxDownloadWs($sessionWs);

// Get a list of your databox
$databoxList = $databoxDownloadWs->get();
var_dump($databoxList);
/**
 * array
 *   0 =>
 *     CSoellinger\FonWebservices\Result\DataboxDownload\ListItem
 *       stnr => (string) '99 999/9999'
 *       name => (string) 'Mustermann Max'
 *       anbringen => (string) 'STB-ZUSI'
 *       zrvon => (string) ''
 *       zrbis => (string) ''
 *       datbesch => (string) '2019-07-15+02:00'
 *       erltyp => (string) 'B'
 *       fileart => (string) 'PDF'
 *       ts_zust => (string) '2020-11-02T07:04:10.044+01:00'
 *       applkey => (string) '2019-07-15-11.45.07.000000'
 *       filebez => (string) '99_9999999_B_2008-11-20_2008-11-20-100948804630.PDF'
 *       status => (string) ''
 */

// Get one entry by the applkey
$entry = $databoxDownloadWs->getEntry($databoxList[0]->applkey);
var_dump($entry);
/**
 * (string) 'JVBERi0xLjQNJeLjz9MNCjYgMCBvYmoNPDwvTGluZWFyaXplZCAxL0wgNTk1Ny9PIDgvRSAxNzAzL'...
 */
 bash
composer