Skip to content

Commit 22f99bd

Browse files
committed
提交文件。
0 parents  commit 22f99bd

20 files changed

+945
-0
lines changed

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2015 CloudXNS, https://github.com/CloudXNS <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
##A parallel CloudXNS sdk written in pure PHP##
2+
3+
4+
##Requirements##
5+
6+
PHP >= 5.4.0
7+
8+
##Install##
9+
10+
If you do not have [Composer](https://getcomposer.org/), you may install it by following the instructions at [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-nix).
11+
12+
###Install First###
13+
14+
Extract the archive file downloaded from [CloudXNS-API-SDK-PHP.zip](https://github.com/CloudXNS/CloudXNS-API-SDK-PHP/archive/master.zip) to your project.
15+
You can then install using the following command:
16+
```shell
17+
composer install
18+
```
19+
20+
###Install Second###
21+
you can then install using the following command:
22+
```shell
23+
composer require "cloudxns/cloud-xns-api-sdk-php:*"
24+
cd vendor/cloudxns/cloud-xns-api-sdk-php/
25+
composer require "hightman/httpclient:*"
26+
```
27+
28+
##Demo##
29+
==================================================
30+
```php
31+
use Cloudxns\Api;
32+
33+
$api = new Api();
34+
$api->setApiKey('xxxxx');
35+
$api->setSecretKey('xxxx');
36+
$api->setProtocol(true);
37+
38+
//获取域名列表
39+
$api->domain->domainList();
40+
41+
42+
//添加域名
43+
$arr = array("domain"=>"cloudxns.net");
44+
$api->domain->domainAdd($arr);
45+
46+
47+
//删除域名
48+
$api->domain->domainDelete('/5568');
49+
```

composer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "cloudxns/cloudxns-api-sdk-php",
3+
"description": "CloudXNS SDK FILES",
4+
"homepage": "https://www.cloudxns.net/",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "CloudXNS",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"autoload": {
13+
"psr-4": {
14+
"CloudXNS\\": "src/"
15+
}
16+
},
17+
"require-dev": {
18+
"hightman/httpclient": "*"
19+
}
20+
}

demo/Config.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* 导入相关的文件
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once '../src/Api.php';

demo/DomainDemo.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* 域名的接口逻辑处理的Demo
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once 'Config.inc.php';
10+
use Cloudxns\Api;
11+
12+
$api = new Api();
13+
$api->setApiKey('XXX');
14+
$api->setSecretKey('XXX');
15+
$api->setProtocol(true);
16+
17+
//获取域名列表
18+
$api->domain->domainList();
19+
20+
21+
//添加域名
22+
$arr = array("domain"=>"cloudxns.net");
23+
$api->domain->domainAdd($arr);
24+
25+
26+
//删除域名
27+
$api->domain->domainDelete('/5568');
28+
29+
30+
31+
32+

demo/HostDemo.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* 主机记录的接口逻辑处理的Demo
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once 'Config.inc.php';
10+
use Cloudxns\Api;
11+
12+
$api = new Api();
13+
$api->setApiKey('xxxx');
14+
$api->setSecretKey('xxx');
15+
$api->setProtocol(true);
16+
17+
//主机记录列表
18+
$api->host->hostList('/5574?offset=0&row_num=30');
19+
20+
//删除主机
21+
$api->host->hostDelete('/49566');

demo/LineDemo.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* 线路&区域&ISP列表的接口逻辑处理的Demo
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once 'Config.inc.php';
10+
use Cloudxns\Api;
11+
12+
$api = new Api();
13+
$api->setApiKey('xxxx');
14+
$api->setSecretKey('xxxx');
15+
$api->setProtocol(true);
16+
17+
//线路列表
18+
$api->setProtocol(false);
19+
$api->line->lineList();
20+
21+
//区域列表
22+
$api->setProtocol(false);
23+
$api->line->lineList('/region');
24+
25+
//ISP列表
26+
$api->setProtocol(true);
27+
$api->line->lineList('/isp');

demo/NsDemo.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* NS服务器列表的接口逻辑处理的Demo
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once 'Config.inc.php';
10+
use Cloudxns\Api;
11+
12+
$api = new Api();
13+
$api->setApiKey('xxxxx');
14+
$api->setSecretKey('xxxxx');
15+
$api->setProtocol(true);
16+
17+
//NS服务器列表
18+
$api->ns->nsList();

demo/RecordDemo.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* 解析记录的接口逻辑处理的Demo
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once 'Config.inc.php';
10+
use Cloudxns\Api;
11+
12+
$api = new Api();
13+
$api->setApiKey('xxxx');
14+
$api->setSecretKey('xxxx');
15+
$api->setProtocol(true);
16+
17+
18+
//解析量的统计
19+
$api->record->recordList("/5574?host_id=0&offset=0&row_num=30");
20+
21+
//新增解析记录
22+
$arr = array(
23+
'domain_id' => 5574,
24+
'host' => 'mp3',
25+
'value' => '192.168.100.210',
26+
'type' => 'A',
27+
'mx' => 55,
28+
'ttl' => 600,
29+
'line_id' => 48
30+
);
31+
$api->record->recordAdd($arr);
32+
33+
//新增备记录
34+
$arr1 = array(
35+
'domain_id' => 5574,
36+
'host_id' => 49565,
37+
'record_id' => 106943,
38+
'value' => '192.168.100.222'
39+
);
40+
$api->record->spareAdd($arr1);
41+
42+
//更新解析记录
43+
$arr2 = array(
44+
'domain_id' => 5574,
45+
'host' => 'www',
46+
'value' => '192.168.100.210',
47+
'type' => 'A',
48+
'mx' => 55,
49+
'ttl' => 600,
50+
'line_id' => 48
51+
);
52+
$api->record->recordUpdate($arr2, "/106943");
53+
54+
55+
//删除解析记录
56+
$api->record->recordDelete("/106943/5574");
57+
58+
59+
//批量删除解析记录,暂未开放
60+
//$record = new Record('', "/5574?host_id=106943&type=A&line_id=1&recursion=true");
61+
//$record->recordDelAll();

demo/RecordTypeDemo.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* 记录类型列表的接口逻辑处理的Demo
4+
*
5+
* @author CLoudXNS <[email protected]>
6+
* @link https://www.cloudxns.net/
7+
* @copyright Copyright (c) 2015 Cloudxns.
8+
*/
9+
require_once 'Config.inc.php';
10+
use Cloudxns\Api;
11+
12+
$api = new Api();
13+
$api->setApiKey('xxxx');
14+
$api->setSecretKey('xxxxx');
15+
$api->setProtocol(true);
16+
17+
//记录类型列表
18+
$api->recordType->typeList();

0 commit comments

Comments
 (0)