📄 about email.txt
字号:
------------------------------------------------------------------------------------------
时代互联SCP体系API接口模式-域名注册接口演示程序说明
------------------------------------------------------------------------------------------
1、从web.config中提取SCP服务器地址、端口,SCP帐号和密码
string HostName = ConfigurationSettings.AppSettings["HostName"]; #SCP服务器地址
int HostPort = Convert.ToInt32(ConfigurationSettings.AppSettings["HostPort"]); #SCP服务器端口
string VCPID = ConfigurationSettings.AppSettings["VCPID"]; #SCP帐号
string VCPPassword = ConfigurationSettings.AppSettings["VCPPassword"]; #SCP帐号的密码
因为SCP服务器地址、端口,SCP帐号和密码存放在web.config文件中,所以可以很方便地在每一个页面都用同样的方法来获取。
2、调用演示程序的核心dll程序集
<%@ Import Namespace="com.todayisp.NowClient" %>
存放在网站根目录下的bin文件夹下的NowClient.dll是一个经过编译的程序集,可以在每一页的顶做一个命名空间引入。
3、构造发送XML的类SendXML
SendXML myClient = new SendXML(HostName, HostPort, VCPID, VCPPassword);
构造SendXML的类,把SCP的服务器地址端口、帐号密码参数传入,以初始化该类。
4、组织生成XML格式字符串,并发送XML到SCP服务器
构造XML有两种方法,一是完全构造一个直观的XML字符串:
string xml = "<action>"+domainSuffix(Request.Form["domain"])+":createDomain</action>\n"+
"<domain:name>"+Request.Form["domain"]+"</domain:name>\n"+
"<domain:period>"+Request.Form["period"]+"</domain:period>\n"+
... ...
myClient.Add(xml);
myClient.Send();
sendXML=myClient.getsendXML();
二是使用SendXML类中的一个方法:
Hashtable KeyValue = new Hashtable();
KeyValue["action"]=domainSuffix(domains)+":checkDomain";
KeyValue["domain:name"]=domains;
... ...
myClient.Add(KeyValue);
myClient.Send();
sendXML=myClient.getsendXML();
5、构造接收XML的类ReceiveXML
ReceiveXML receivexml = new ReceiveXML(myClient.getresponseXML());
其中myClient.getresponseXML()是上面的那一个发送XML的类的一个接收返回XML的方法,把返回的信息作为参数传入ReceiveXML类的构造函数。
6、处理返回的XML信息
string msg = receivexml.getMsg(); #取得<msg>里的信息
string code = receivexml.getCode(); #取得<code>里的信息
bool isSuccess = receivexml.isSuccess(); #判断发送过去的命令是否处理成功
string responseXML=receivexml.getXML(myClient.getresponseXML()); #取得返回的XML信息的字符串
Hashtable resdataHash=receivexml.getResData(); #返回数据的Hashtable集
string domain = resdataHash["domain:name"].ToString(); #从resdataHash里得到<domain:name>abc.com<domain:name>中的abc.com
... ...
string type = receivexml.getResDataNode("domain:contact","type"); #取得<domain:contact type="admin" pw="***">里的type的值
#如果有多个<domain:contact>则使用";"来分隔开的字符串
返回:
1. <result>标签表示返回的执行信息,code属性为执行状态,<msg>为信息提示
成功为:
2000 Command completed successfully
.
注册失败,域名已经被注册:
4005 *.* has been regist,choice other
.
错误的信息(如不是用户注册的域名,缺少必要的信息):
4002 Authorization error
.
非法的命令: 如果开头不是以“域名后缀:命令名”开头,如dotcom:createDomain
4001 action is illegal(:createDomain)
.
帐上金额不足:
4004 userid:* No enough Money(need * )
.
2.<resdata>标签表示返回的数据信息
其中创建域名时返回的<domain:name><domain:roid><domain:contact>信息要牢记,以后查询或修改可能都要用到
具体信息可参考《域名注册客户端XML使用说明》附录里的code信息,或者上时代互联代理平台www.todaynic.com 上查看最新的接口说明
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -