新网域名net接入源码

public class XinNetApiBase{//默认代理编号public readonly static string AgentID = "agent88888";private Enco

public class XinNetApiBase

{

//默认代理编号

public readonly static string AgentID = "agent88888";

private Encoding _WebEncode = Encoding.GetEncoding("UTF-8"); private string _RequestString;

private string _Result;

private string _RequestUrl;

private WebClient _EWebClient = new WebClient();

///

/// 处理编码

///

public Encoding WebEncode

{

get { return _WebEncode; }

set { _WebEncode = value; }

}

///

/// 请求的查询参数

///

public string RequestString

{

get { return _RequestString; }

set { _RequestString = value; }

}

///

/// 请求返回的结果

///

public string Result

{

get { return _Result; }

set { _Result = value; }

}

,

///

/// 请求的URL 地址

///

public string RequestUrl

{

get { return _RequestUrl; }

set { _RequestUrl = value; }

}

///

/// 客户端与服务器通信类

///

public WebClient EWebClient

{

get { return _EWebClient; }

set { _EWebClient = value; }

}

public XinNetApiBase(ApiType _apitype, List _list) {

this.RequestUrl = GetApiUrl(_apitype);

this.RequestString = GetRequestString(_list);

this.GetHttp();

}

public XinNetApiBase(string _ApiUrl, List _list) {

this.RequestUrl = _ApiUrl;

this.RequestString = GetRequestString(_list);

}

public string GetRequestString(List list) {

string requestUrl = "";

foreach (QueryParam q in list)

{

requestUrl = q.QueryName "="

,

HttpUtility.UrlEncode(q.QueryValue, this.WebEncode) "&";

}

return requestUrl.TrimEnd('&');

}

public string GetHttp()

{

this.EWebClient.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");

this.EWebClient.Encoding = this.WebEncode;

this.Result = this.EWebClient.UploadString(new Uri(this.RequestUrl), "POST", this.RequestString);

return this.Result;

}

public string GetApiUrl(ApiType _ApiType)

{

string _Url = "";

switch (_ApiType)

{

case ApiType.Check:

_Url = "http://api.xinnet.com/domain/api.gb?method=check&charset=utf-8"; break;

case ApiType.Register:

_Url = "http://api.xinnet.com/domain/api.gb?method=Register&charset=utf-8"; break;

case ApiType.Status:

_Url = "http://api.xinnet.com/domain/api.gb?method=Status&charset=utf-8"; break;

case ApiType.ModDns:

_Url = "http://api.xinnet.com/domain/api.gb?method=ModDns&charset=utf-8";

,

break;

case ApiType.domain:

_Url = "http://api.xinnet.com/domain/api.gb?method=DomainRenew&charset=utf-8";

break;

case ApiType.GetProductKey:

_Url = "http://api.xinnet.com/domain/api.gb?method=GetProductKey&charset=utf-8";

break;

case ApiType.ChangeProductKey:

_Url = "http://api.xinnet.com/domain/api.gb?method=ChangeProductKey&charset=utf-8";

break;

case ApiType.ModifyContactor:

_Url = "http://api.xinnet.com/domain/api.gb?method=ModifyContactor&charset=utf-8";

break;

default:

_Url = "http://api.xinnet.com/domain/api.gb?method=testmd5&charset=utf-8"; break;

}

return _Url;

}

///

/// MD5加密

///

/// 加密的内容

/// 16或32 表示16位或32位 ///

public static string MD5(string _ConvertString, int _Len)

{

using (System.Security.Cryptography.MD5CryptoServiceProvider provider = new System.Security.Cryptography.MD5CryptoServiceProvider())

,

{

switch (_Len)

{

case 16:

return

4, BitConverter.ToString(provider.ComputeHash(Encoding.UTF8.GetBytes(_ConvertString)),

8).Replace("-",

string.Empty).ToUpper(System.Globalization.CultureInfo.CurrentCulture);

case 32:

return BitConverter.ToString(provider.ComputeHash(Encoding.UTF8.GetBytes(_ConvertString))).Replace("-", string.Empty).ToUpper(System.Globalization.CultureInfo.CurrentCulture); default:

return BitConverter.ToString(provider.ComputeHash(Encoding.UTF8.GetBytes(_ConvertString))).Replace("-", string.Empty).ToUpper(System.Globalization.CultureInfo.CurrentCulture);

}

}

}

}

public class QueryParam

{

private string _QueryName;

private string _QueryValue;

public string QueryName

{

set { this._QueryName = value; }

get { return this._QueryName; }

}

public string QueryValue

{

,

set { this._QueryValue = value; }

get { return this._QueryValue; }

}

public QueryParam(string _Name, string _Value)

{

this.QueryName = _Name;

this.QueryValue = _Value;

}

}

public enum ApiType

{

Check,

Register,

Status,

ModDns,

domain,

GetProductKey,

ChangeProductKey,

ModifyContactor

}

List param = new List();

param.Add(new QueryParam("name", "viqiwu")); param.Add(new QueryParam("enc", "E"));

param.Add(new QueryParam("suffix", ".com")); param.Add(new QueryParam("suffix", ".com.cn")); param.Add(new QueryParam("suffix", ".cn"));

param.Add(new QueryParam("client", "agent88888"));

XinNetApiBase _XinNet = new XinNetApiBase(ApiType.Check, param);

Response.Write(_XinNet.Result);

//_XinNet.Result 返回的结果

,

num=3&enc=E&name1=viqiwu.com&chk1=0&name2=viqiwu.com.cn&chk2=100&name3=viqiwu.cn&chk3=0

//chk1=0 表示不能注册了 chk1=100 表示可以注册

Xinnet Corp. 北京新网数码信息技术有限公司

POST 参数注意事项:

所有电话号码及邮编必须为数字,且不能为零

所有英文信息字段必须为

本接口暂时不支持信任制代理

1. 文档说明

1.1 文档简介

本版本采用HTTP POST方式进行注册。

1.2 使用限制

只有新网的正式代理才能使用。

必须符合接口认证方式才能提交命令。

注册接口按照该代理的价格进行实时注册实时扣费,如果预付款不足,将不能提交注册申请。 接口文档的获得和传播必须符合新网的保密协议

1.3 操作说明

1。代理在新网代理专区填写授权POST 的IP 地址和认证密码。

2。按照接口说明编写客户端程序向接口提交查询、注册命令,立刻获得结果。

1.4 域名范围

国际域名,.com,.net,.org,.biz,.info ,.cc,.mobi 域名, 包括中文.com,.cc

国内域名,.cn,.com.cn 类,. 中国,. 网络,. 公司, 通用网址

1.5 md5串测试地址:

url:http://api.xinnet.com/domain/api.gb?method=testmd5

输出:strbuf 内容及编码后的md5串

中文编码使用gb2312 或者utf-8编码,否则易出现md5校验错误:verify-failure 摘要认证失败 关于此处说明:请确保相关程序文件的charset 设置和文件自身保存的编码一致。

并请保证所有关联文件编码一致,您明确要求不一致(需转码)的除外

gb2312和utf-8中文md5结果可能不同,请确保提交内容字符集和md5串一致。

2. 接口概述

2.1 接口目录

Check接口:主要负责进行域名的查询,采用多线程方式,可以同时查询多个域名

Register接口:注册接口,实时注册,成功后立即扣费。如果超时,不转为后台注册,域名将被删除。

不提供通用网址注册服务。

,

Status接口:查询域名是否注册成功。

ModDns接口: 进行在线修改DNS 操作。

domain续费接口:域名续费接口,实时续费,立即扣费。

获取产品密码接口:获取域名管理密码、mydns 密码以及域名到期时间。

修改产品密码接口:修改域名管理密码以及mydns 密码。

ModifyContactor 接口:修改除域名所有人以外的所有联系人信息。

注册本域名下的DNS :注册本域名下的DNS 。

查询本域名下的DNS :查询本域名下的DNS 。

修改本域名下的DNS :修改本域名下的DNS 。

删除本域名下的DNS :删除本域名下的DNS 。

2.2 认证方式

1。IP 限制,对于任何接口必须从该代理授权的IP, 每个代理限填3个IP 地址

2。MD5非可逆加密摘要,除Check 接口、和Status 接口外,其它所有接口都要求提供

2.3 返回结果

按照POST 数据格式返回数据结果

3. 接口说明

3.1 Check 接口

POST 地址: http://api.xinnet.com/domain/api.gb?method=check

enc 编码,E,G ;1个;

suffix 后缀;1-N 个, 域名后缀.com/.net/.org/.中国/cnaddr/.公司/

client 代理号;1个

t111

POST 数据,必须进行URL 编码

验证:client 和POST 的来源IP 必须与该代理填写的地址一致

返回结果: num 域名数量

enc 编码

name[1--N] 域名, 名字 后缀 N=num

chk[1--N] N=num 查询结果: 0 不可注册 100 可以注册

信息编码:

auth-failure 认证失败

例如:name=abc&enc=E&suffix=.com&suffix=.net&suffix=.cn&client=agen

,

例如:num=3&enc=E&name1=abc.com&chk1=0&name2=abc.net&chk2=100&name3=abc.org&chk3=-100

注意:通用网址suffix=cnaddr(目前仅提供老通用网址续费,不提供注册服务)

3.2 Register 接口

POST 地址: http://api.xinnet.com/domain/api.gb?method=Register

POST 参数:

[域名信息]

dn 域名;1个, 包括名字和后缀

enc 编码,E,G ;1个;

client 代理号;1个

checksum MD5加密摘要

,

uteln 注册人电话号码 (区号 电话号码长度必须小于12)

utele 注册人电话分机

ufaxc 注册人传真国家码, 可以不填默认为86,长度不能大于3位

ufaxa 注册人传真区号 如果为手机可以不填,此项不可为0

ufaxn 注册人传真号码 必须为数字 (区号 传真号码长度必须小于12) ufaxe 注册人传真分机

uemail 注册人email 地址

trade 注册人所在行业英文编码 [如果不填,默认为商业S8]//此字段最好不填,如果

填写,千万不能用小写S

[域名管理联系人信息] 管理联系人单位地址信息和注册人信息一致,所以不用填

uincode travel域名UIN 编码 travel域名必须,其他域名不需要

certtype asia域名证件类型 asia域名必须,其他域名不需要

passport 护照或居民身份证

certificate 营业执照

legislation 特许成立的法定机构证明

societiesRegistry 非营利团体登记证明

politicalPartyRegistry 政党注册证明

other 其他

certcode asia域名证件号码 asia域名必须,其他域名不需要

entitytype asia域名实体类型 asia域名必须,其他域名不需要

naturalPerson 个人

corporation 公司或社团法人

cooperative 合作社

partnership 合伙或集体公司

government 政府机关

politicalParty 政党或工会

society 信托管理机构﹑资产管理机构﹑协会或社团

institution 公共机构

other 其他

aname1 管理联系人中文名称 [国内域名必填]

aname2 管理联系人英文名称 [国际域名必填]

atelc 管理联系人电话国家码 可以不填默认为86,长度不能大于3位

atela 管理联系人电话区号 如果为手机可以不填

ateln 管理联系人电话号码 区号 电话号码长度必须小于12

atele 管理联系人电话分机 可以不填,此项不可为0

标签: