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接口类相关推荐

  1. 新网域名查询和注册API接口类 源码

    最近公司要做一个基于新网的API,在自己的系统中实现实时查询域名注册情况,并且要能实时注册,注册费用自动从我们的代理帐户中扣除,下面是我写的核心实现类代码:     public class XinN ...

  2. php 查询域名被注册,查询域名是否被注册 API 接口调用请求

    原标题:查询域名是否被注册 API 接口调用请求 查询域名是否被注册 API 接口在网上已经很多且大都封装成了 API 供别人调用,以GET/POST方式提交即可.查询域名是否被注册 API 接口可以 ...

  3. 域服务器如何修改域名,新网域名如何修改DNS设置方法

    在新网注册的域名,DNS默认为新网DNS服务器(例如:ns11.xincache.com.ns12.xincache.com). 为了方便管理,使用西部数码的智能DNS解析服务,可以将域名的DNS修改 ...

  4. python爬虫api接口,网易云音乐python爬虫api接口

    抓包能力有限,分析了一下网易云音乐的一些api接口,但是关于它很多post请求都是加了密,没有弄太明白.之前在知乎看到过一个豆瓣工程师写的教程,但是被投诉删掉了,请问有网友fork了的吗?因为我觉得他 ...

  5. 淘宝天猫开放平台店铺商品发布(新)-淘宝店铺发布API接口流程代码对接说明

    淘宝天猫开放平台店铺商品发布(新)-淘宝店铺发布API接口,天猫店铺发布API接口,oAuth2.0店铺发布接口,店铺商品API接口,店铺商品接口发布API接口流程代码对接说明: 公共参数 名称 类型 ...

  6. php 百度收录api_PHP查询百度收录API接口源码

    PHP查询百度收录API接口源码,对很多站长们很实用,随时查询自己网站域名到底被百度清清楚楚的收录个多少页面统计出来. API接口代码 header("Access-Control-Allo ...

  7. 新网域名管理后台介绍

    新网作为国内知名域名注册商,新网在域名管理后台方面也有着更多的经验,也更为了解用户在域名管理和域名解析方面使用习惯,小编就以用户的身份来体验一下 新网域名管理后台     新网作为国内知名域名注册商, ...

  8. 新网服务器网站后台怎么登陆,新网域名管理后台

    在新网域名管理后台的系统中,您只需要拥有域名管理密码,即可以管理域名.域名证书的作用是证明域名所有权.如果您需要对网站进行备案时,需要提供给您的主机空间服务商.所有通过新网注册并交纳相应注册费用的用户 ...

  9. 关于网易云音乐爬虫的api接口?

    抓包能力有限,分析了一下网易云音乐的一些api接口,但是关于它很多post请求都是加了密,没有弄太明白.之前在知乎看到过一个豆瓣工程师写的教程,但是被投诉删掉了,请问有网友fork了的吗?因为我觉得他 ...

最新文章

  1. Activity-生命周期
  2. Python 获取图片文件大小并转换为base64编码
  3. mysql workbench 在模板与数据库间同步
  4. 世界上最浪费时间的三件事
  5. as3 urlloader php交互 jsion,phpQuery获取网页里的js变量,如何获取
  6. SSH远程连接:简单的连接
  7. SpringBoot:第一篇 新建spring boot 应用
  8. 大学四年规划英语计算机专业课,大学四年考证规划你get了吗?
  9. 基于DEAP库的python进化算法-7.多目标遗传算法NSGA-II
  10. 年前的面试经历(二)
  11. IntelliJ IDEA 2021.1.2 x64版的 IDEA 创建 jsp项目
  12. GIS公司的主要业务
  13. QQ文件七天未接收失效怎么办?QQ文件失效怎么恢复
  14. 【全网唯一】TC8一致性测试文章合集来袭(持续更新中)
  15. 清风数学建模学习笔记——熵权法(客观赋权法)
  16. excel删除无尽空白行_史上最简单的Excel工资条制作方法,实用收藏!
  17. java jdbc 批量更新_java – JDBC PreparedStatement,批量更新和生成的密钥
  18. 计算机科学导论 -- 第一章 绪论
  19. 国外生活必备的英文词汇
  20. QQ邮箱添加企业邮箱与企业邮箱添加QQ邮箱

热门文章

  1. 一款手机App的配色方案如何建立美观度?
  2. 【Jmeter技巧】 jmeter客户端不自动释放会话
  3. Spack 架构体系
  4. ZUUL的概念及使用
  5. fastadmin表格直接添加序号
  6. 三万长文50+趣图带你领悟web编程的内功心法:一文带你深入解读HTTP的发展史
  7. Python tkinter -- 第15章 Combobox
  8. 最新Java面试300题:腾讯T4面试+美团+京东+拼多多(文末答案附赠)
  9. 应届生标准求职简历表-Word简历可编辑下载
  10. 网站交换友情链接是否对SEO优化有帮助?