当前位置: 首页 > 短信SDK > DELPHI短信SDK
DELPHI短信SDK
参数名称 |
说明 |
是否必须 |
备注 |
Sn |
软件序列号 |
是 |
格式XXX-XXX-XXX-XXXXX |
Pwd |
密码 |
是 |
md5(sn+password) 32位大写密文 |
Mobile |
手机号 |
是 |
必填(支持10000个手机号,建议<=5000)多个英文逗号隔开 |
Content |
内容 |
是 |
支持长短信(详细请看长短信扣费说明) |
Ext |
扩展码 |
否 |
例如:123(默认置空) |
stime |
定时时间 |
否 |
例如:2010-12-29 16:27:03(非定时置空) |
Rrid |
唯一标识 |
否 |
最长18位,只能是数字或者 字母 或者数字+字母的组合 |
函数返回值:String(唯一标识,即当前发送短信批次的唯一标识,和rrid对应,如为空则返回系统生成的rrid),此方法推荐用于大量群发.内容相同手机号多个的情况。
接口地址:http://sdk.entinfo.cn:8060/webservice.asmx?op=mt
示例1
SN= SDK-SSD-010-00001
PWD=3B5D3C427365F40C1D27682D78BB31E0
Mobile:139***404,138***213…………….
Content:测试
Ext: ""
Stime: ""
Rrid: ""
输出结果:
XML格式:
具体函数DELPHI实现:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,IdHTTP,IdHashMessageDigest,IdGlobal, IdHash; type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Edit1: TEdit; Label2: TLabel; Edit2: TEdit; Label3: TLabel; Edit3: TEdit; Label4: TLabel; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } function mt(sn, pwd, mobile, content, stime, ext,rrid: string): string; //发送 function md5(mdstr: string): string; //md5方法 end; var Form1: TForm1; implementation {$R *.dfm} function URLEncode(const msg: String): String; var I : Integer; begin Result := ''; for I := 1 to Length(msg) do begin if msg[I] = ' ' then Result := Result + '+' else if msg[I] in ['a'..'z', 'A'..'Z', '0'..'9'] then Result := Result + msg[I] else Result := Result + '%' + IntToHex(ord(msg[I]), 2); end; end; function TForm1.mt(sn, pwd, mobile, content, stime, ext,rrid: string): string; var aStream: TMemoryStream; Params: TStringStream; ASources:pchar; tl:tstringlist; resultstr,constr,str:string; IdHTTP1:TIdHTTP; jsstring: TStringList;//根据#13 拆分 回车换行符 begin try resultstr:=''; IdHTTP1:=TIdHTTP.Create(nil); aStream := TMemoryStream.Create; Params :=TStringStream.Create(''); constr:='sn='+sn+'&pwd='+pwd+'&mobile='+mobile+'&content='+URLEncode(content)+'&ext='+ext+'&stime='+stime+'&rrid='+rrid; Params.WriteString(constr); IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; IdHTTP1.Request.ContentLength:=length(IdHTTP1.Request.ContentType); IdHTTP1.ReadTimeout:=60000; IdHTTP1.Host:='sdk.entinfo.cn'; IdHTTP1.Port:=8060; with IdHTTP1 do begin IdHTTP1.Post('http://sdk.entinfo.cn:8060/webservice.asmx/mt',Params,aStream); end; jsstring:=Tstringlist.Create; aStream.WriteBuffer(#0' ', 1); ASources:=PChar(aStream.Memory); if ASources<>'' then begin ExtractStrings([#13], [], ASources,jsstring); //以回车换行符对结果拆分; str:=StringReplace(jsstring[1],'','', [rfReplaceAll, rfIgnoreCase]); str:=StringReplace(str,' ','', [rfReplaceAll, rfIgnoreCase]); end else str:='-999'; jsstring.Free; aStream.free; Params.free; resultstr:=str; except on E: Exception do begin resultstr:=''; end; end; result:=resultstr; end; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin showmessage(mt(edit1.Text,md5(edit1.Text+edit2.Text),edit3.Text,memo1.Text,'','','')); end; function TForm1.md5(mdstr: string): string; var MyMD5: TIdHashMessageDigest5; Digest: T4x4LongWordRecord; str:string; begin MyMD5 := TIdHashMessageDigest5.Create; Digest := MyMD5.HashValue(mdstr); str:=MyMD5.AsHex(Digest); result:= str; end; end.
二、webservice返回集合对照表:
返回值 |
返回值说明 |
问题描述 |
-2 |
帐号/密码不正确 |
1.序列号未注册2.密码加密不正确3.密码已被修改4.序列号已注销 |
-4 |
余额不足支持本次发送(或者修改密码长度不正确) |
余额不足(或者修改密码长度不在6位到10位之间) |
-5 |
数据格式错误 |
只能自行调试了。或与技术支持联系 |
-6 |
参数有误 |
看参数传的是否均正常,请调试程序查看各参数 |
-7 |
权限受限 |
该序列号是否已经开通了调用该方法的权限 |
-8 |
流量控制错误 |
|
-9 |
扩展码权限错误 |
该序列号是否已经开通了扩展子号的权限,把ext这个参数置空。 |
-10 |
内容长度长 |
单字节不能超过1000个字符,双字节不能超过500个字符 |
-11 |
内部数据库错误 |
|
-12 |
序列号状态错误 |
序列号是否被禁用 |
-14 |
服务器写文件失败 |
|
-17 |
没有权限 |
如发送彩信仅限于SDK3 |
-19 |
禁止同时使用多个接口地址 |
每个序列号提交只能使用一个接口地址 |
-20 |
相同手机号,相同内容重复提交 |
|
-22 |
Ip鉴权失败 |
提交的IP不是所绑定的IP |
-23 |
缓存无此序列号信息 |
|
-601 |
序列号为空,参数错误 |
|
-602 |
序列号格式错误,参数错误 |
|
-603 |
密码为空,参数错误 |
|
-604 |
手机号码为空,参数错误 |
|
-605 |
内容为空,参数错误 |
|
-606 |
ext长度大于9,参数错误 |
|
-607 |
参数错误 扩展码非数字 |
|
-608 |
参数错误 定时时间非日期格式 |
|
-609 |
rrid长度大于18,参数错误 |
|
-610 |
参数错误 rrid非数字 |
|
-611 |
参数错误 内容编码不符合规范 |
|
-623 |
手机个数与内容个数不匹配 |
|
-624 |
扩展个数与手机个数数 |
|
-644 |
rrid个数与手机个数不一致 |
|
注:以上返回值针对个别方法.请具体参看每个用到方法的详细说明。
三、附加说明:
1.接口地址:
常用接口地址:http://sdk.entinfo.cn:8060/webservice.asmx (一般调用)
多线程接口地址:http://sdk.entinfo.cn:8061/webservice.asmx (java、andriod使用)
2.其它说明:
(1)开发使用的帐号必须为SDK开头,如SDK-SSD-010-00001,帐号第一次需要调用Register方法注册一次.仅需注册一次即可,信息必须真实
(2)UnRegister与Register配合使用, 连续使用不得超过10次/天;
(3)群发推荐使用接口方法 mt或者mdSmsSend (仅方法名不同);
3. 郑重声明:
(1)禁止相同的内容多个手机号连续一条一条提交. 否则禁用帐号,由此带来损失由客户自行负责.
(2)请客户提供外网服务器IP以便于绑定IP发送,提高账号的安全性!
(3)在程序里最好有配置文件,程序自动判断当某个接口连接超时提交速度变慢时.程序可以自动切换其它的接口以下是推荐的几个服务器,仅接口地址不同而已.方法全部相同;
地址1:http://sdk.entinfo.cn:8060/webservice.asmx
地址2:http://sdk2.entinfo.cn:8060/webservice.asmx
这些地址都是标准的webservice地址,C#,Java客户可以按照自己熟悉的方式去解析String
或者
地址1:http://sdk.entinfo.cn:8060/webservice.asmx?wsdl
地址2:http://sdk2.entinfo.cn:8060/webservice.asmx?wsdl
四、示例Demo源代码下载: