新網(wǎng)域名net接入源碼
public class XinNetApiBase{//默認(rèn)代理編號(hào)public readonly static string AgentID = "agent88888";private Enco
public class XinNetApiBase
{
//默認(rèn)代理編號(hào)
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; }
}
///
/// 請求的查詢參數(shù)
///
public string RequestString
{
get { return _RequestString; }
set { _RequestString = value; }
}
///
/// 請求返回的結(jié)果
///
public string Result
{
get { return _Result; }
set { _Result = value; }
}
,///
/// 請求的URL 地址
///
public string RequestUrl
{
get { return _RequestUrl; }
set { _RequestUrl = value; }
}
///
/// 客戶端與服務(wù)器通信類
///
public WebClient EWebClient
{
get { return _EWebClient; }
set { _EWebClient = value; }
}
public XinNetApiBase(ApiType _apitype, List
this.RequestUrl = GetApiUrl(_apitype);
this.RequestString = GetRequestString(_list);
this.GetHttp();
}
public XinNetApiBase(string _ApiUrl, List
this.RequestUrl = _ApiUrl;
this.RequestString = GetRequestString(_list);
}
public string GetRequestString(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加密
///
/// 加密的內(nèi)容
/// 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.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 返回的結(jié)果
,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. 北京新網(wǎng)數(shù)碼信息技術(shù)有限公司
POST 參數(shù)注意事項(xiàng):
所有電話號(hào)碼及郵編必須為數(shù)字,且不能為零
所有英文信息字段必須為
本接口暫時(shí)不支持信任制代理
1. 文檔說明
1.1 文檔簡介
本版本采用HTTP POST方式進(jìn)行注冊。
1.2 使用限制
只有新網(wǎng)的正式代理才能使用。
必須符合接口認(rèn)證方式才能提交命令。
注冊接口按照該代理的價(jià)格進(jìn)行實(shí)時(shí)注冊實(shí)時(shí)扣費(fèi),如果預(yù)付款不足,將不能提交注冊申請。 接口文檔的獲得和傳播必須符合新網(wǎng)的保密協(xié)議
1.3 操作說明
1。代理在新網(wǎng)代理專區(qū)填寫授權(quán)POST 的IP 地址和認(rèn)證密碼。
2。按照接口說明編寫客戶端程序向接口提交查詢、注冊命令,立刻獲得結(jié)果。
1.4 域名范圍
國際域名,.com,.net,.org,.biz,.info ,.cc,.mobi 域名, 包括中文.com,.cc
國內(nèi)域名,.cn,.com.cn 類,. 中國,. 網(wǎng)絡(luò),. 公司, 通用網(wǎng)址
1.5 md5串測試地址:
url:http://api.xinnet.com/domain/api.gb?method=testmd5
輸出:strbuf 內(nèi)容及編碼后的md5串
中文編碼使用gb2312 或者utf-8編碼,否則易出現(xiàn)md5校驗(yàn)錯(cuò)誤:verify-failure 摘要認(rèn)證失敗 關(guān)于此處說明:請確保相關(guān)程序文件的charset 設(shè)置和文件自身保存的編碼一致。
并請保證所有關(guān)聯(lián)文件編碼一致,您明確要求不一致(需轉(zhuǎn)碼)的除外
gb2312和utf-8中文md5結(jié)果可能不同,請確保提交內(nèi)容字符集和md5串一致。
2. 接口概述
2.1 接口目錄
Check接口:主要負(fù)責(zé)進(jìn)行域名的查詢,采用多線程方式,可以同時(shí)查詢多個(gè)域名
Register接口:注冊接口,實(shí)時(shí)注冊,成功后立即扣費(fèi)。如果超時(shí),不轉(zhuǎn)為后臺(tái)注冊,域名將被刪除。
不提供通用網(wǎng)址注冊服務(wù)。
,Status接口:查詢域名是否注冊成功。
ModDns接口: 進(jìn)行在線修改DNS 操作。
domain續(xù)費(fèi)接口:域名續(xù)費(fèi)接口,實(shí)時(shí)續(xù)費(fèi),立即扣費(fèi)。
獲取產(chǎn)品密碼接口:獲取域名管理密碼、mydns 密碼以及域名到期時(shí)間。
修改產(chǎn)品密碼接口:修改域名管理密碼以及mydns 密碼。
ModifyContactor 接口:修改除域名所有人以外的所有聯(lián)系人信息。
注冊本域名下的DNS :注冊本域名下的DNS 。
查詢本域名下的DNS :查詢本域名下的DNS 。
修改本域名下的DNS :修改本域名下的DNS 。
刪除本域名下的DNS :刪除本域名下的DNS 。
2.2 認(rèn)證方式
1。IP 限制,對于任何接口必須從該代理授權(quán)的IP, 每個(gè)代理限填3個(gè)IP 地址
2。MD5非可逆加密摘要,除Check 接口、和Status 接口外,其它所有接口都要求提供
2.3 返回結(jié)果
按照POST 數(shù)據(jù)格式返回?cái)?shù)據(jù)結(jié)果
3. 接口說明
3.1 Check 接口
POST 地址: http://api.xinnet.com/domain/api.gb?method=check
enc 編碼,E,G ;1個(gè);
suffix 后綴;1-N 個(gè), 域名后綴.com/.net/.org/.中國/cnaddr/.公司/
client 代理號(hào);1個(gè)
t111
POST 數(shù)據(jù),必須進(jìn)行URL 編碼
驗(yàn)證:client 和POST 的來源IP 必須與該代理填寫的地址一致
返回結(jié)果: num 域名數(shù)量
enc 編碼
name[1--N] 域名, 名字 后綴 N=num
chk[1--N] N=num 查詢結(jié)果: 0 不可注冊 100 可以注冊
信息編碼:
auth-failure 認(rèn)證失敗
例如: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
注意:通用網(wǎng)址suffix=cnaddr(目前僅提供老通用網(wǎng)址續(xù)費(fèi),不提供注冊服務(wù))
3.2 Register 接口
POST 地址: http://api.xinnet.com/domain/api.gb?method=Register
POST 參數(shù):
[域名信息]
dn 域名;1個(gè), 包括名字和后綴
enc 編碼,E,G ;1個(gè);
client 代理號(hào);1個(gè)
checksum MD5加密摘要
,uteln 注冊人電話號(hào)碼 (區(qū)號(hào) 電話號(hào)碼長度必須小于12)
utele 注冊人電話分機(jī)
ufaxc 注冊人傳真國家碼, 可以不填默認(rèn)為86,長度不能大于3位
ufaxa 注冊人傳真區(qū)號(hào) 如果為手機(jī)可以不填,此項(xiàng)不可為0
ufaxn 注冊人傳真號(hào)碼 必須為數(shù)字 (區(qū)號(hào) 傳真號(hào)碼長度必須小于12) ufaxe 注冊人傳真分機(jī)
uemail 注冊人email 地址
trade 注冊人所在行業(yè)英文編碼 [如果不填,默認(rèn)為商業(yè)S8]//此字段最好不填,如果
填寫,千萬不能用小寫S
[域名管理聯(lián)系人信息] 管理聯(lián)系人單位地址信息和注冊人信息一致,所以不用填
寫
uincode travel域名UIN 編碼 travel域名必須,其他域名不需要
certtype asia域名證件類型 asia域名必須,其他域名不需要
passport 護(hù)照或居民身份證
certificate 營業(yè)執(zhí)照
legislation 特許成立的法定機(jī)構(gòu)證明
societiesRegistry 非營利團(tuán)體登記證明
politicalPartyRegistry 政黨注冊證明
other 其他
certcode asia域名證件號(hào)碼 asia域名必須,其他域名不需要
entitytype asia域名實(shí)體類型 asia域名必須,其他域名不需要
naturalPerson 個(gè)人
corporation 公司或社團(tuán)法人
cooperative 合作社
partnership 合伙或集體公司
government 政府機(jī)關(guān)
politicalParty 政黨或工會(huì)
society 信托管理機(jī)構(gòu)﹑資產(chǎn)管理機(jī)構(gòu)﹑協(xié)會(huì)或社團(tuán)
institution 公共機(jī)構(gòu)
other 其他
aname1 管理聯(lián)系人中文名稱 [國內(nèi)域名必填]
aname2 管理聯(lián)系人英文名稱 [國際域名必填]
atelc 管理聯(lián)系人電話國家碼 可以不填默認(rèn)為86,長度不能大于3位
atela 管理聯(lián)系人電話區(qū)號(hào) 如果為手機(jī)可以不填
ateln 管理聯(lián)系人電話號(hào)碼 區(qū)號(hào) 電話號(hào)碼長度必須小于12
atele 管理聯(lián)系人電話分機(jī) 可以不填,此項(xiàng)不可為0