2018-11-19
./domain_create.pl test.com
{
"status": {
"code": 300,
"name": "操作成功",
"message": "",
"request_time": "2018-11-19 04:50:02"
},
"data": {
"domainid": 3563130,
"userid": 432756,
"domainname": "test.com",
"grade": "免费套餐",
"domain_status": "正常",
"domain_active": "yes",
"groupid": 0,
"nsstate": "未知",
"createtime": "2018-11-19 04:49:58"
}
domain_create.pl
#!/usr/bin/perl
$domain=$ARGV[0];
$cmd="create";
$apiid="testit";
$apipass="testAPI";
$groupid="";
$do = 'curl -G "https://api.dns.la/api/Domain.ashx" ';
$do = $do.' --data-urlencode "cmd='.$cmd.'"';
$do = $do.' --data-urlencode "apiid='.$apiid.'"';
$do = $do.' --data-urlencode "apipass='.$apipass.'"';
$do = $do.' --data-urlencode "domain='.$domain.'"';
$do = $do.' --data-urlencode "groupid='.$groupid.'"';
$do = $do.' --silent';
$ret_data=`$do`;
print $ret_data;
./set.pl test.com aaa wsdvs.com
{
"status": {
"code": 300,
"name": "操作成功",
"message": "",
"request_time": "2018-11-19 03:29:23"
},
"resultid": 9448875
set.pl
#!/usr/bin/perl
$domain=$ARGV[0];
chomp($domain);
$host=$ARGV[1];
chomp($host);
$cdn=$ARGV[2];
chomp($cdn);
$cmd="create";
$apiid="testit";
$apipass="testAPI";
$recorddata=$host.".".$domain.".".$cdn;
$do = 'curl -G "https://api.dns.la/api/record.ashx?rtype=json&domainid=&recordtype=CNAME&recordline=Def&mxpriority=&ttl=600" ';
$do = $do.' --data-urlencode "cmd='.$cmd.'"';
$do = $do.' --data-urlencode "apiid='.$apiid.'"';
$do = $do.' --data-urlencode "apipass='.$apipass.'"';
$do = $do.' --data-urlencode "domain='.$domain.'"';
$do = $do.' --data-urlencode "host='.$host.'"';
$do = $do.' --data-urlencode "recorddata='.$recorddata.'"';
$do = $do.' --silent';
$ret_data=`$do`;
print $ret_data;
./del.pl def.test.com
$VAR1 = '{
"status": {
"code": 300,
"name": "操作成功",
"message": "",
"request_time": "2018-11-19 04:27:53"
}
}';
del.pl
#!/usr/bin/perl
use JSON;
$cmd="list";
$apiid="testit";
$apipass="testAPI";
$rtype="json";
$fqdn=$ARGV[0];
chomp($fqdn);
$domain=substr($fqdn,index($fqdn,".")+1);
$host=substr($fqdn,0,index($fqdn,"."));
$do = 'curl -G "https://api.dns.la/Api/record.ashx" ';
$do = $do.' --data-urlencode "cmd='.$cmd.'"';
$do = $do.' --data-urlencode "apiid='.$apiid.'"';
$do = $do.' --data-urlencode "apipass='.$apipass.'"';
$do = $do.' --data-urlencode "rtype='.$rtype.'"';
$do = $do.' --data-urlencode "domain='.$domain.'"';
$do = $do.' --silent';
$ret_data=`$do`;
$ret_data = substr($ret_data, index($ret_data,"["));
$ret_data = substr($ret_data, 0, index($ret_data,"]")+1);
$obj = from_json($ret_data);
foreach $item( @$obj ) {
if( $item->{host} eq $host){
$cmd = "remove";
$recordid = $item->{recordid};
$do = 'curl -G "https://api.dns.la/api/record.ashx" ';
$do = $do.' --data-urlencode "cmd='.$cmd.'"';
$do = $do.' --data-urlencode "apiid='.$apiid.'"';
$do = $do.' --data-urlencode "apipass='.$apipass.'"';
$do = $do.' --data-urlencode "rtype='.$rtype.'"';
$do = $do.' --data-urlencode "domain='.$domain.'"';
$do = $do.' --data-urlencode "recordid='.$recordid.'"';
$do = $do.' --silent';
$ret_data=`$do`;
print $ret_data;
}
}
domain_create.pl
#!/usr/bin/perl
$domain=$ARGV[0];
$cmd="create";
$apiid="testit";
$apipass="testAPI";
$groupid="";
$do = 'curl -G "https://api.dns.la/api/Domain.ashx" ';
$do = $do.' --data-urlencode "cmd='.$cmd.'"';
$do = $do.' --data-urlencode "apiid='.$apiid.'"';
$do = $do.' --data-urlencode "apipass='.$apipass.'"';
$do = $do.' --data-urlencode "domain='.$domain.'"';
$do = $do.' --data-urlencode "groupid='.$groupid.'"';
$do = $do.' --silent';
$ret_data=`$do`;
print $ret_data;
./domain_del.pl test.com
{
"status": {
"code": 300,
"name": "操作成功",
"message": "",
"request_time": "2018-11-19 04:56:58"
}