PHP code example of krencl / wedos-api

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

    

krencl / wedos-api example snippets




use Krencl\WedosApi\Configuration;

$configuration = Configuration::createFromFile(__DIR__ . '/config.json');



use Krencl\WedosApi\Configuration;

$configuration = new Configuration('user', 'password');

// optional
$configuration->setTestingMode(true);
$configuration->setUrl('https://...');



use Krencl\WedosApi\Command;
use Krencl\WedosApi\Constants;

/** @var \Krencl\WedosApi\Request $command */
$command = new Command\DomainsList(Constants\DomainStatus::ACTIVE);



use Krencl\WedosApi\Request;
use Krencl\WedosApi\Constants;

$request = new Request('domains-list', [
	'status' => Constants\DomainStatus::ACTIVE,
]);



use Krencl\WedosApi\Client;
use Krencl\WedosApi\Configuration;
use Krencl\WedosApi\Command;
use Krencl\WedosApi\Constants;
use Krencl\WedosApi\Exception\ResponseException;

$configuration = Configuration::createFromFile(__DIR__ . '/../config.json.dist');
$client = new Client($configuration);

$clTRID = 'myCustomId-1';
$command = new Command\DomainsList(Constants\DomainStatus::ACTIVE, $clTRID);

try {
	$response = $client->sendRequest($command);
	var_dump($response->getData());
} catch (ResponseException $e) {
	echo (string) $e;
	var_dump($e->getResponse()->getCurlResult());
}