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('your-api-key');

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

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

$simply->accounts()     // getAccountList
$simply->billing()      // getInvoices
$simply->database()     // getMysqlDatabases
$simply->dnszone()      // addDnsRecord, ddnsHelper, deleteDnsRecord, dyndns, getDnsRecords, getDnsZone, reloadDnsZone, updateDnsRecord
$simply->domains()      // domaincheck
$simply->logs()         // getFirewallLogs
$simply->mail()         // addMailAccount, addMailForward, getMailAccounts, getMailForwards
$simply->order()        // createOrder, getOrderableProducts, orderDnsService
$simply->products()     // getProductList
$simply->registry()     // addDnssecKey, getDnssecKeys, getNameservers, removeDnssec, setNameservers
$simply->serverstatus() // getServerStatusMessages
$simply->subdomains()   // getSubdomains
$simply->urlforwards()  // addUrlForward, deleteUrlForward, getUrlForwards

use SimplyCom\Client;

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

$response = $simply->dnszone()->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('your-api-key');

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

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

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

use SimplyCom\Client;

$simply = new Client('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('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('your-api-key');

try {
    $simply->dnszone()->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('your-api-key', $http);
bash
composer