<?php

/**
 * 导入相关的文件
 *
 * @author CLoudXNS <*****@*****.**>
 * @link https://www.cloudxns.net/
 * @copyright Copyright (c) 2015 Cloudxns.
 */
require_once '../src/Api.php';
use Cloudxns\Api;
$api = new Api();
$api->setApiKey('XXXX');
//需要替换
$api->setSecretKey('XXXX');
//需要替换
$api->setProtocol(false);
//true使用https接口,需要配置ssl根证书
<?php

/**
 * 主机记录的接口逻辑处理的Demo
 * 
 * @author CLoudXNS <*****@*****.**>
 * @link https://www.cloudxns.net/
 * @copyright Copyright (c) 2015 Cloudxns.
 */
require_once 'Config.inc.php';
use Cloudxns\Api;
$api = new Api();
$api->setApiKey('xxxxx');
$api->setSecretKey('xxxxx');
$api->setProtocol(true);
/**
 * 主机列表的获取
 * 
 * @param integer $domainId  域名ID
 * @param integer $offset 记录开始的偏移,第一条记录为 0
 * @param integer $rowNum 要获取的记录的数量,最大可取 2000条
 * @return string
 */
echo $api->host->hostList(2125, 0, 30);
/**
 * 主机记录的删除
 * 
 * @param integer $hostId 主机记录 id
 * @return string
 */
echo $api->host->hostDelete(48088);
 * @author CloudXNS <*****@*****.**>
 * @link https://www.cloudxns.net/
 * @copyright Copyright (c) 2015 Cloudxns.
 */
require_once '../vendor/autoload.php';
use CloudXNS\Api;
$api->setApiKey('xxxxxxxxxx');
$api->setSecretKey('xxxxxxxxxx');
$protocol = true;
$action = isset($_POST['action']) ? $_POST['action'] : 'domainList';
if (empty($apiKey) || empty($secretKey)) {
    ajaxReturn(20000, 'API KEY或者SECRET KEY不能为空!');
}
$api = new Api();
$api->setApiKey($apiKey);
$api->setSecretKey($secretKey);
if ($protocol) {
    $api->setProtocol(false);
} else {
    $api->setProtocol(true);
}
switch ($action) {
    case 'domainList':
        domainList($api);
        break;
    case 'domainAdd':
        domainAdd($api);
        break;
    case 'domainDelete':
        domainDelete($api);
        break;