PHP code example of qcloudns / client

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

    

qcloudns / client example snippets




use Qcloudns\Client;
use Qcloudns\ZoneManager;
use Qcloudns\RecordManager;
$authId = 'your-auth-id';
$authPassword = 'your-auth-password';
$client = new Client($authId, $authPassword);
$zoneManager = new ZoneManager($client);
$recordManager = new RecordManager($client);

$response = $zoneManager->createZone('example.com');
print_r($response);

$response = $zoneManager->updateZone('example.com');
print_r($response);

$response = $zoneManager->listZones();
print_r($response);


$response = $zoneManager->dwleteZones('example.com');
print_r($response);


$data = [
    'record-type' => 'A',
    'host' => 'www',
    'record' => '192.0.2.1',
    'ttl' => 3600,
    'priority' => 10
];
$response = $recordManager->createRecord('example.com', $data);
print_r($response);

$data = [
    'record-id' => 1234,
    'host' => 'www',
    'record' => '192.0.2.1',
    'ttl' => 3600,
    'priority' => 10
];
$response = $recordManager->updateRecord('example.com', $data);
print_r($response);

$response = $recordManager->getRecord(string $domain, string $recordid);
print_r($response);

$response = $recordManager->listRecords(string $domain);
print_r($response);

$response = $recordManager->deleteRecord(string $domain, string $recordid);
print_r($response);