新网域名查询和注册API接口类
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(); /// <summary> /// 处理编码 /// </summary> public Encoding WebEncode { get { return _WebEncode; } set { _WebEncode = value; } } /// <summary> /// 请求的查询参数 /// </summary> public string RequestString { get { return _RequestString; } set { _RequestString = value; } } /// <summary> /// 请求返回的结果 /// </summary> public string Result { get { return _Result; } set { _Result = value; } } /// <summary> /// 请求的URL地址 /// </summary> public string RequestUrl { get { return _RequestUrl; } set { _RequestUrl = value; } } /// <summary> /// 客户端与服务器通信类 /// </summary> public WebClient EWebClient { get { return _EWebClient; } set { _EWebClient = value; } } public XinNetApiBase(ApiType _apitype, List<QueryParam> _list) { this.RequestUrl = GetApiUrl(_apitype); this.RequestString = GetRequestString(_list); this.GetHttp(); } public XinNetApiBase(string _ApiUrl, List<QueryParam> _list) { this.RequestUrl = _ApiUrl; this.RequestString = GetRequestString(_list); } public string GetRequestString(List<QueryParam> 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; } /// <summary> /// MD5加密 /// </summary> /// <param name="_ConvertString">加密的内容</param> /// <param name="_Len">16或32 表示16位或32位</param> /// <returns></returns> public static string MD5(string _ConvertString, int _Len) { using (System.Security.Cryptography.MD5CryptoServiceProvider provider = new System.Security.Cryptography.MD5CryptoServiceProvider()) { switch (_Len) { case 16: return BitConverter.ToString(provider.ComputeHash(Encoding.UTF8.GetBytes(_ConvertString)), 4, 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<QueryParam> param = new List<QueryParam>();
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 表示可以注册
出处:http://www.cnblogs.com/taven/archive/2009/09/05/1560697.html
新网域名查询和注册API接口类相关推荐
- 新网域名查询和注册API接口类 源码
最近公司要做一个基于新网的API,在自己的系统中实现实时查询域名注册情况,并且要能实时注册,注册费用自动从我们的代理帐户中扣除,下面是我写的核心实现类代码: public class XinN ...
- php 查询域名被注册,查询域名是否被注册 API 接口调用请求
原标题:查询域名是否被注册 API 接口调用请求 查询域名是否被注册 API 接口在网上已经很多且大都封装成了 API 供别人调用,以GET/POST方式提交即可.查询域名是否被注册 API 接口可以 ...
- 域服务器如何修改域名,新网域名如何修改DNS设置方法
在新网注册的域名,DNS默认为新网DNS服务器(例如:ns11.xincache.com.ns12.xincache.com). 为了方便管理,使用西部数码的智能DNS解析服务,可以将域名的DNS修改 ...
- python爬虫api接口,网易云音乐python爬虫api接口
抓包能力有限,分析了一下网易云音乐的一些api接口,但是关于它很多post请求都是加了密,没有弄太明白.之前在知乎看到过一个豆瓣工程师写的教程,但是被投诉删掉了,请问有网友fork了的吗?因为我觉得他 ...
- 淘宝天猫开放平台店铺商品发布(新)-淘宝店铺发布API接口流程代码对接说明
淘宝天猫开放平台店铺商品发布(新)-淘宝店铺发布API接口,天猫店铺发布API接口,oAuth2.0店铺发布接口,店铺商品API接口,店铺商品接口发布API接口流程代码对接说明: 公共参数 名称 类型 ...
- php 百度收录api_PHP查询百度收录API接口源码
PHP查询百度收录API接口源码,对很多站长们很实用,随时查询自己网站域名到底被百度清清楚楚的收录个多少页面统计出来. API接口代码 header("Access-Control-Allo ...
- 新网域名管理后台介绍
新网作为国内知名域名注册商,新网在域名管理后台方面也有着更多的经验,也更为了解用户在域名管理和域名解析方面使用习惯,小编就以用户的身份来体验一下 新网域名管理后台 新网作为国内知名域名注册商, ...
- 新网服务器网站后台怎么登陆,新网域名管理后台
在新网域名管理后台的系统中,您只需要拥有域名管理密码,即可以管理域名.域名证书的作用是证明域名所有权.如果您需要对网站进行备案时,需要提供给您的主机空间服务商.所有通过新网注册并交纳相应注册费用的用户 ...
- 关于网易云音乐爬虫的api接口?
抓包能力有限,分析了一下网易云音乐的一些api接口,但是关于它很多post请求都是加了密,没有弄太明白.之前在知乎看到过一个豆瓣工程师写的教程,但是被投诉删掉了,请问有网友fork了的吗?因为我觉得他 ...
最新文章
- Activity-生命周期
- Python 获取图片文件大小并转换为base64编码
- mysql workbench 在模板与数据库间同步
- 世界上最浪费时间的三件事
- as3 urlloader php交互 jsion,phpQuery获取网页里的js变量,如何获取
- SSH远程连接:简单的连接
- SpringBoot:第一篇 新建spring boot 应用
- 大学四年规划英语计算机专业课,大学四年考证规划你get了吗?
- 基于DEAP库的python进化算法-7.多目标遗传算法NSGA-II
- 年前的面试经历(二)
- IntelliJ IDEA 2021.1.2 x64版的 IDEA 创建 jsp项目
- GIS公司的主要业务
- QQ文件七天未接收失效怎么办?QQ文件失效怎么恢复
- 【全网唯一】TC8一致性测试文章合集来袭(持续更新中)
- 清风数学建模学习笔记——熵权法(客观赋权法)
- excel删除无尽空白行_史上最简单的Excel工资条制作方法,实用收藏!
- java jdbc 批量更新_java – JDBC PreparedStatement,批量更新和生成的密钥
- 计算机科学导论 -- 第一章 绪论
- 国外生活必备的英文词汇
- QQ邮箱添加企业邮箱与企业邮箱添加QQ邮箱