PHP code example of idoit / apiclient

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

    

idoit / apiclient example snippets



use Idoit\APIClient\API;
use Idoit\APIClient\Idoit;

$start = time();

ple:
$request = new Idoit($api);
$request->readVersion();

fwrite(STDERR, 'Last request:' . PHP_EOL);
fwrite(STDERR, '=============' . PHP_EOL);
fwrite(STDERR, $api->getLastRequestHeaders() . PHP_EOL);
fwrite(STDERR, json_encode($api->getLastRequestContent(), JSON_PRETTY_PRINT) . PHP_EOL);
fwrite(STDERR, PHP_EOL);
fwrite(STDERR, '--------------------------------------------------------------------------------' . PHP_EOL);
fwrite(STDERR, 'Last response:' . PHP_EOL);
fwrite(STDERR, '==============' . PHP_EOL);
fwrite(STDERR, $api->getLastResponseHeaders() . PHP_EOL);
fwrite(STDERR, json_encode($api->getLastResponse(), JSON_PRETTY_PRINT) . PHP_EOL);
fwrite(STDERR, PHP_EOL);
fwrite(STDERR, '--------------------------------------------------------------------------------' . PHP_EOL);
fwrite(STDERR, 'Last connection:' . PHP_EOL);
fwrite(STDERR, '================' . PHP_EOL);
$info = $api->getLastInfo();
unset($info['request_header']);
foreach ($info as $key => $value) {
    if (is_array($value)) {
        $value = '…';
    }
    fwrite(STDERR, $key . ': ' . $value . PHP_EOL);