PHP code example of unoeuro / api-php

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

    

unoeuro / api-php example snippets




implyCom\Client;

$simply = new Client('S123456', 'your-api-key');

$products = $simply->products()->getProductList();

foreach ($products->getProducts() as $product) {
    echo $product->getObject() . PHP_EOL;
}

$simply->billing()       // invoices
$simply->database()      // MySQL databases on a product
$simply->dns()           // DNS zones, records, DDNS
$simply->domains()       // domain availability checks
$simply->mail()          // mail accounts on a product
$simply->order()         // place new orders
$simply->products()      // list products on the account
$simply->registry()      // registry-level data (nameservers, DNSSEC)
$simply->serverStatus()  // public server status messages

use SimplyCom\Client;

$simply = new Client('S123456', 'your-api-key');

$response = $simply->dns()->getDnsRecords('example.com');

foreach ($response->getRecords() as $record) {
    printf("%-6s %-30s %s\n", $record->getType(), $record->getName(), $record->getData());
}

use SimplyCom\Client;
use SimplyCom\Model\DnsRecordPayload;
use SimplyCom\Model\DnsRecordType;

$simply = new Client('S123456', 'your-api-key');

$payload = new DnsRecordPayload([
    'type' => DnsRecordType::A,
    'name' => 'www',
    'data' => '1.2.3.4',
    'ttl'  => 3600,
]);

$result = $simply->dns()->addDnsRecord('example.com', $payload);

echo 'Created record id ' . $result->getRecord()->getId() . PHP_EOL;

use SimplyCom\Client;

$simply = new Client('S123456', 'your-api-key');

$check = $simply->domains()->domaincheck('example.com')->getDomain();

if ($check->getAvailable()) {
    echo 'Available!' . PHP_EOL;
} elseif ($check->getCantransfer()) {
    echo 'Taken, but can be transferred.' . PHP_EOL;
} else {
    echo 'Taken.' . PHP_EOL;
}

use SimplyCom\Client;

$simply = new Client('S123456', 'your-api-key');

foreach ($simply->billing()->getInvoices()->getInvoices() as $invoice) {
    printf("%s  %s %s  %s\n",
        $invoice->getDate(),
        number_format($invoice->getAmount(), 2),
        $invoice->getCurrency(),
        $invoice->getSubject(),
    );
}

use SimplyCom\Client;
use SimplyCom\ApiException;

$simply = new Client('S123456', 'your-api-key');

try {
    $simply->dns()->getDnsRecords('not-your-domain.com');
} catch (ApiException $e) {
    echo $e->getCode() . ': ' . $e->getMessage() . PHP_EOL;
    echo $e->getResponseBody();
}

use GuzzleHttp\Client as Guzzle;
use SimplyCom\Client;

$http = new Guzzle(['timeout' => 10.0]);
$simply = new Client('S123456', 'your-api-key', $http);
bash
composer