当前位置:文档之家› 短信平台—接口文档1065

短信平台—接口文档1065

二次开发接口说明

目录

二次开发接口说明 (1)

短信二次接口技术 (2)

支持多种操作体统:WINDOWS、LINUX、UNIX (2)

支持多种开发语言:C#、VB、delphi、VC++、ASP、JAVA、.NET、HTML等 (2)

支持编码格式:UTF-8编码 (3)

第一章发送接口 (3)

1.1 请求地址 (3)

1.2参数说明 (3)

1.3返回值 (4)

1.4 实例 (4)

第二章余额及已发送量查询接口 (14)

2.1 请求地址 (14)

2.2参数说明 (14)

2.3返回值 (14)

2.4 实例 (15)

第三章非法关键词查询 (24)

3.1 请求地址 (24)

3.2参数说明 (24)

3.3返回值 (24)

3.4 实例 (25)

第四章状态报告接口 (34)

4.1请求地址 (34)

4.2参数说明 (34)

4.3返回值 (34)

4.4错误返回值——状态报告请求错误返回格式及对应值 (35)

4.5 实例 (35)

第五章上行接口 (44)

5.1 请求地址 (44)

5.2参数说明 (44)

5.3返回值 (45)

5.4错误返回值——回复请求错误返回格式及对应值 (45)

5.5 实例 (46)

短信二次接口技术

随着移动商务应用和3G无线技术的加速普及和深入发展与用户需求的变化,短信用户群由时尚人群不断向企业、行业用户扩展。短信作为一种实用、方便、廉价的通信手段,越来越多地成为企业、行业人士日常工作不可或缺的通讯工具;同时,短信应用范围也由通用服务向企业、行业应用领域扩展。短信应用不再局限于交互游戏等娱乐方式,它已经介入到企业办公、银行、证券、保险、交通、教育、社保、数据采集等领域,已成为企业、行业应用密不可分的一部分。面向企业、行业的短信业务逐渐成为短信应用的一个重要组成部分,越来越多的企业开始利用短信平台开展各种短信增值业务如:OA管理系统、短信商业信息发布系统、短信客户关系管理系统、短信呼叫中心、进销存系统、短信防伪、生产管理系统、短信数据采集等。业务系统、网站、客户管理系统、进销存系统、OA、生产管理系统。手机也势必会成为企业信息化管理、移动商务办公的又一大信息终端。

支持多种操作体统:WINDOWS、LINUX、UNIX

支持多种开发语言:C#、VB、delphi、VC++、ASP、JAVA、.NET、HTML等

支持开发方式:Http协议

支持编码格式:UTF-8编码

主要说明

注意事项1

请注意接口对应的访问连接和所需要的参数以及参数名称,注意返回值的解析和保存,以方便自己调试用。

第一章发送接口

1.1 请求地址

请求地址是客户接口程序调用时请求的url地址,采用的是http post 接口,地址是

客户端地址+sms.aspx 例如:http://114.112.64.134:8888/sms.aspx;

入口地址一般不会发生变化,当发生变化的时候,会通知接口用户

1.2参数说明

http://114.112.64.134:8888/sms.a spx?action=send

参数名称含义说明

userid企业id 企业ID

account 发送用户帐号用户帐号,由系统管理员

password 发送帐号密码用户账号对应的密码

mobile 全部被叫号码发信发送的目的号码.多个号码之间用半角逗

号隔开

content 发送内容短信的内容

sendTime 定时发送时间为空表示立即发送,定时发送格式2010-10-24

09:08:10

action 发送任务命令设置为固定的:send

checkcontent 是否检查内容包含非法

当设置为1时表示需要检查,默认0为不检查关键字

taskName 任务名称本次任务描述100个字以内可以为空countnumber 号码总数量本次提交的号码总数量

mobilenumber 手机号码数量本次提交的手机号码数量

telephonenumber 小灵通或座机号码数本次提交的小灵通或座机号码数数量

例如:

action=send&userid=12&account=账号&password=密码&mobile=150********,135********&content=内容&sendTime=&taskName=本次任务描述&checkcontent=1&mobilenumber=10&countnumber=12&telephonenumber=2

1.3返回值

在接收到客户端发送的http请求后,返回以xml的方式返回处理结果。格式为:

status ---------- 返回状态值:成功返回Success 失败返回:Faild

message ---------- 返回信息:见下表

remainpoint ---------- 返回余额

taskID ----------- 返回本次任务的序列ID

successCounts --成功短信数:当成功后返回提交成功短信数

返回信息提示说明

ok 提交成功

用户名或密码不能为空提交的用户名或密码为空

发送内容包含sql注入字符包含sql注入字符

用户名或密码错误表示用户名或密码错误

短信号码不能为空提交的被叫号码为空

短信内容不能为空发送内容为空

包含非法字符:表示检查到不允许发送的非法字符

对不起,您当前要发送的量大于您当前余额当支付方式为预付费是,检查到账户余额不足

其他错误其他数据库操作方面的错误

1.4 实例

1.4.1 C#实例

以下实例仅供参考,可以根据需要自行进行处理加工或修改,如果需要技术支持,请联系软维技术

其他的也可以参考本内容进行操作。只是参数形式不一样而已。获取之后进行自己解析然后提

取所需要的信息即可。

C# 实例:

try{

Encoding myEncoding = Encoding.GetEncoding("UTF-8");

string param = "action=send&userid=" + userid + "&account=" + HttpUtility.UrlEncode(account, myEncoding) + "&password=" + HttpUtility.UrlEncode(password, myEncoding) + "&mobile=130********,132********&content=" + HttpUtility.UrlEncode(content, myEncoding) + "&sendTime=" + HttpUtility.UrlEncode(sendTime, myEncoding) + "&mobilenumber=2&countnumber=2&telephonenumber=0";

byte[] postBytes = Encoding.ASCII.GetBytes(param);

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://114.112.64.134:8888/sms.aspx");

req.Method = "POST";

req.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";

req.ContentLength = postBytes.Length;

using (Stream reqStream = req.GetRequestStream())

{

reqStream.Write(postBytes, 0, postBytes.Length);

}

System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();

using (WebResponse wr = req.GetResponse())

{

StreamReader sr = new StreamReader(wr.GetResponseStream(), System.Text.Encoding.UTF8);

System.IO.StreamReader xmlStreamReader = sr;

xmlDoc.Load(xmlStreamReader);

}

if (xmlDoc == null)

{

MessageBox.Show("请求发生异常" );

}

else {

String message = xmlDoc.GetElementsByTagName("message").Item(0).InnerText.ToString();

if(message =="ok"){

MessageBox.Show("发送成功" );

}

else {

MessageBox.Show(message );

}

}

}

catch (https://www.doczj.com/doc/964003063.html,.WebException WebExcp)

{

MessageBox.Show("网络错误,无法连接到服务器!" );

}

1.4.2 JAVA实例

以下实例仅供参考,可以根据需要自行进行处理加工或修改,如果需要技术支持,请联系软维技术

同样的,发送,余额,关键字,报告,回复,都可以通过同一个方式的不同参数和连接来获取。必须要保证的是访问的地址和参数不要出错。

发送,采用

http://114.112.64.134:8888/sms.aspx

action为send

/**

*

* 2012-03-01

*

*

* @param url

* :必填--发送/余额/关键字连接地址URL--比

如>http://114.112.64.134:8888/sms.aspx

* : 状态用 http://114.112.64.134:8888/statusApi.aspx

* :回复用 http://114.112.64.134:8888/callApi.aspx *

* @param userid

* :必填--用户ID,为数字

* @param account

* :必填--用户帐号

* @param password

* :必填--用户密码

* @param mobile

* :必填--发送的手机号码,多个可以用逗号隔比

如>135********,136********

* @param content

* :必填--实际发送内容,

* @param action

* :选填--访问的事件,默认为send

* :事件参数。比如

:发送 send

:余额 overage

:关键字 checkkeyword

:状态/回复 query

* @param sendTime

* :选填--定时发送时间,不填则为立即发送,时间格式如>2011-11-11 11:11:11

* @param checkContent

* :选填--检查是否包含非法关键字,1--表示需要检查,0--表示不检查

* @param taskName

* :选填--任务名称,本次任务描述,100字内

* @param countNumber

* :选填--提交号码总数

* @param mobileNumber

* :选填--手机号码总数

* @param telephoneNumber

* :选填--小灵通(和)或座机总数

* @param sendType

* :选填--发送方式,默认为POST

* @param codingType

* :选填--发送内容编码方式,默认为UTF-8

* @param backEncodType

* :选填--返回内容编码方式,默认为UTF-8

* @return返回发送之后收到的信息

*/

public static String sendSms(String url, String userid, String account, String password, String mobile, String content, String action,

String sendTime, String checkContent, String taskName,

String countNumber, String mobileNumber, String telephoneNumber,

String sendType, String codingType, String backEncodType) {

try {

if (codingType == null || codingType.equals("")) {

codingType = "UTF-8";

}

if (backEncodType == null || backEncodType.equals("")) {

backEncodType = "UTF-8";

}

StringBuffer send = new StringBuffer();

if (action != null && !action.equals("")) {

send.append("action=").append(action);

} else {

send.append("action=send");

}

send.append("&userid=").append(userid);

send.append("&account=").append(

URLEncoder.encode(account, codingType));

send.append("&password=").append(

URLEncoder.encode(password, codingType));

send.append("&mobile=").append(mobile);

send.append("&content=").append(

URLEncoder.encode(content, codingType));

if (sendTime != null && !sendTime.equals("")) {

send.append("&sendTime=").append(

URLEncoder.encode(sendTime, codingType));

}

if (checkContent != null && !checkContent.equals("")) {

send.append("&checkContent=").append(checkContent);

}

if (taskName != null && !taskName.equals("")) {

send.append("&taskName=").append(

URLEncoder.encode(taskName, codingType));

}

if (countNumber != null && !countNumber.equals("")) {

send.append("&countNumber=").append(countNumber);

}

if (mobileNumber != null && !mobileNumber.equals("")) {

send.append("&mobileNumber=").append(mobileNumber);

}

if (telephoneNumber != null && !telephoneNumber.equals("")) { send.append("&telephoneNumber=").append(telephoneNumber);

}

if(sendType != null&& (sendType.toLowerCase()).equals("get")) {

return SmsClientAccessTool.getInstance().doAccessHTTPGet(

url + "?" + send.toString(), backEncodType);

} else {

return

SmsClientAccessTool.getInstance().doAccessHTTPPost(url,

send.toString(), backEncodType);

}

} catch (Exception e) {

e.printStackTrace();

return"未发送,编码异常";

}

}

/**

*

* POST方法

*

*

* @param sendUrl

* :访问URL

* @param paramStr

* :参数串

* @param backEncodType

* :返回的编码

* @return

*/

public String doAccessHTTPPost(String sendUrl, String sendParam, String backEncodType) {

StringBuffer receive = new StringBuffer();

BufferedWriter wr = null;

try {

if (backEncodType == null || backEncodType.equals("")) { backEncodType = "UTF-8";

}

URL url = new URL(sendUrl);

HttpURLConnection URLConn = (HttpURLConnection) url

.openConnection();

URLConn.setDoOutput(true);

URLConn.setDoInput(true);

((HttpURLConnection) URLConn).setRequestMethod("POST");

URLConn.setUseCaches(false);

URLConn.setAllowUserInteraction(true);

HttpURLConnection.setFollowRedirects(true);

URLConn.setInstanceFollowRedirects(true);

URLConn.setRequestProperty("Content-Type",

"application/x-www-form-urlencoded;charset=UTF-8");

URLConn.setRequestProperty("Content-Length", String

.valueOf(sendParam.getBytes().length));

DataOutputStream dos = new DataOutputStream(URLConn

.getOutputStream());

dos.writeBytes(sendParam);

BufferedReader rd = new BufferedReader(new InputStreamReader( URLConn.getInputStream(), backEncodType));

String line;

while ((line = rd.readLine()) != null) {

receive.append(line).append("\r\n");

}

rd.close();

} catch (java.io.IOException e) {

receive.append("访问产生了异常-->").append(e.getMessage());

e.printStackTrace();

} finally {

if (wr != null) {

try {

wr.close();

} catch (IOException ex) {

ex.printStackTrace();

}

wr = null;

}

}

return receive.toString();

}

1.4.3 https://www.doczj.com/doc/964003063.html,实例

以下实例仅供参考,可以根据需要自行进行处理加工或修改,如果需要技术支持,请联系软维技术

说明:https://www.doczj.com/doc/964003063.html,主要是针对下面的发送程序而言的,其中地址,参数均采用自定义的方式进行,所以下面的所有几乎雷同。注意采用的方式即可。

发送,采用

http://114.112.64.134:8888/sms.aspx

action为send

'''

''' 所有都可以以这个为入口进行操作。包括发送,余额,关键字,状态,回复,等。

'''

'''

''' 访问地址。比如:

''' 发送/余额/关键字用 http://114.112.64.134:8888/sms.aspx

''' 状态用 http://114.112.64.134:8888/statusApi.aspx

''' 回复用 http://114.112.64.134:8888/callApi.aspx

'''

'''

''' 事件参数。比如

''' 发送 send

''' 余额 overage

''' 关键字 checkkeyword

''' 状态/回复 query

'''

'''

''' 用户帐号的ID

'''

'''

''' 用户帐号

'''

'''

''' 用户密码

'''

'''

''' 不用

'''

'''

''' 手机号码,逗号隔开

'''

'''

''' 发送内容或者关键字检查内容

'''

'''

Private Sub SendMsgPost(ByVal urlText As System.String, ByVal actionParam As System.String, ByVal userid As System.String, ByVal account As System.String, ByVal password As System.String, ByVal sendMethod As System.String, ByVal mobiles As System.String, ByVal contents As System.String) Dim sendurl As http_getpost = New http_getpost

Dim encode As ComCodeFunction = New ComCodeFunction

Dim sends As String

sends = "action=" & actionParam

sends = sends & "&userid=" & encode.UTF8Encode(userid)

sends = sends & "&account=" & encode.UTF8Encode(account)

sends = sends & "&password=" & encode.UTF8Encode(password)

sends = sends & "&mobile=" & encode.UTF8Encode(mobiles)

sends = sends & "&content=" & encode.UTF8Encode(contents)

Me.sendWebBrowser.Text = urlText + "?" + sends

Dim returnmsg As String

returnmsg = sendurl.http_post(urlText, sends)

'Dim sr As StreamReader = New StreamReader(returnmsg, Encoding.UTF8)

Me.returnMsg.Text = returnmsg 'Encoding.UTF8.GetString(returnmsg)

End Sub

'HTTP读取--返回字符串

'HTTP 1.1 POST方式

'geturl=网址=形如:http://120.72.35.47:8888/sms.aspx

'text=所有的参数=形如:action=send&userid=帐号ID&account=帐号&password=密码&&mobile=发送的号码&content=发送的内容

Function http_post(ByVal geturl As String, ByVal text As String) As String

Dim myHttpWebRequest As https://www.doczj.com/doc/964003063.html,.HttpWebRequest

Dim myHttpWebResponse As https://www.doczj.com/doc/964003063.html,.HttpWebResponse

Try

Dim URL As String = geturl

Dim myUri As Uri = New Uri(geturl)

Dim myWebRequest As https://www.doczj.com/doc/964003063.html,.WebRequest = https://www.doczj.com/doc/964003063.html,.WebRequest.Create(URL)

myHttpWebRequest = CType(myWebRequest, https://www.doczj.com/doc/964003063.html,.HttpWebRequest)

myHttpWebRequest.KeepAlive = True

myHttpWebRequest.Timeout = 3000000

myHttpWebRequest.Method = "POST"

Dim encoding As New System.Text.UTF8Encoding

Dim byte1 As Byte() = encoding.GetBytes(text)

myHttpWebRequest.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"

myHttpWebRequest.ContentLength = text.Length

Dim newStream As System.IO.Stream = myHttpWebRequest.GetRequestStream()

newStream.Write(byte1, 0, byte1.Length)

newStream.Close()

Dim myWebResponse As https://www.doczj.com/doc/964003063.html,.WebResponse = myHttpWebRequest.GetResponse()

myHttpWebResponse = CType(myWebResponse, https://www.doczj.com/doc/964003063.html,.HttpWebResponse)

Dim iStatCode As Integer = CInt(myHttpWebResponse.StatusCode)

myHttpWebResponse = CType(myWebResponse, https://www.doczj.com/doc/964003063.html,.HttpWebResponse)

Dim myStream As System.IO.Stream = myHttpWebResponse.GetResponseStream()

Dim srReader As System.IO.StreamReader = New System.IO.StreamReader(myStream, System.Text.Encoding.UTF8)

Dim sTemp As String = srReader.ReadToEnd()

http_post = sTemp

srReader.Close()

myStream.Close()

myWebResponse.Close()

myWebRequest.Abort()

Catch WebExcp As https://www.doczj.com/doc/964003063.html,.WebException

http_post = Replace(WebExcp.Message.ToString(), "The remote server returned an error: (500) Internal Server Error.", "服务器出现故障无法连接")

Catch ex As Exception

http_post = ex.ToString()

End Try

End Function

1.4.4 ASP实例

详见文档

1.4.5 PHP实例

详见文档

1.4.6 DELPHI实例

详见文档

1.4.7 HTML实例

详见文档

第二章余额及已发送量查询接口

2.1 请求地址

请求地址是客户接口程序调用的时候请求的url地址,采用的是http post接口,地址是http://114.112.64.134:8888/sms.aspx

入口地址一般不会发生变化,当发生变化的时候,会通知接口用户

2.2参数说明

参数名称含义说明

userid企业id 企业ID

account 用户帐号用户帐号,由系统管理员

password 帐号密码用户账号对应的密码

action 任务名称设置为固定的:overage

例如:

action=overage&userid=12&account=账号&password=密码

2.3返回值

status-------返回状态值:成功返回Success 失败返回:Faild message--------------返回信息提示:见下表

payinfo--------------返回支付方式后付费,预付费

overage-------------返回已发送条数

sendTotal----返回总点数当支付方式为预付费是返回总充值点数

返回信息提示说明

返回空查询成功

将返回相应的支付方式、账户使用条数、总充值点数

用户名或密码不能为空提交的用户名或密码为空

用户名或密码错误表示用户名或密码错误

2.4 实例

2.4.1 C#实例

以下实例仅供参考,可以根据需要自行进行处理加工或修改,如果需要技术支持,请联系软维技术

C# 实例:

try{

Encoding myEncoding = Encoding.GetEncoding("UTF-8");

string param = "action=overage&userid=" + userid + "&account=" + HttpUtility.UrlEncode(account, myEncoding) + "&password=" + HttpUtility.UrlEncode(password, myEncoding) ;

byte[] postBytes = Encoding.ASCII.GetBytes(param);

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://114.112.64.134:8888/sms.aspx");

req.Method = "POST";

req.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";

req.ContentLength = postBytes.Length;

using (Stream reqStream = req.GetRequestStream())

{

reqStream.Write(postBytes, 0, postBytes.Length);

}

System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();

using (WebResponse wr = req.GetResponse())

{

StreamReader sr = new StreamReader(wr.GetResponseStream(), System.Text.Encoding.UTF8);

System.IO.StreamReader xmlStreamReader = sr;

xmlDoc.Load(xmlStreamReader);

}

if (xmlDoc == null)

{

MessageBox.Show("请求发生异常" );

}

else {

String returnstatus= xmlDoc.GetElementsByTagName("returnstatus").Item(0).InnerText.ToString();

String message = xmlDoc.GetElementsByTagName("message").Item(0).InnerText.ToString();

String overage= xmlDoc.GetElementsByTagName("overage").Item(0).InnerText.ToString();

if(returnstatus=="Success"){

MessageBox.Show("查询余额成功" );

}

else {

MessageBox.Show(message );

}

}

}

catch (https://www.doczj.com/doc/964003063.html,.WebException WebExcp)

{

MessageBox.Show("网络错误,无法连接到服务器!" ); }

2.4.2 JAVA实例

以下实例仅供参考,可以根据需要自行进行处理加工或修改,如果需要技术支持,请联系软维技术

同样的,发送,余额,关键字,报告,回复,都可以通过同一个方式的不同参数和连接来获取。必须要保证的是访问的地址和参数不要出错。以下实例仅供技术

余额,采用

http://114.112.64.134:8888/sms.aspx

action为overage

/**

*

* 2012-03-01

*

*

* @param url

* :必填--发送/余额/关键字连接地址URL--比

如>http://114.112.64.134:8888/sms.aspx

* : 状态用 http://114.112.64.134:8888/statusApi.aspx

* :回复用 http://114.112.64.134:8888/callApi.aspx *

* @param userid

* :必填--用户ID,为数字

* @param account

* :必填--用户帐号

* @param password

* :必填--用户密码

* @param mobile

* :必填--发送的手机号码,多个可以用逗号隔比

如>135********,136********

* @param content

* :必填--实际发送内容,

* @param action

* :选填--访问的事件,默认为send

* :事件参数。比如

:发送 send

:余额 overage

:关键字 checkkeyword

:状态/回复 query

* @param sendTime

* :选填--定时发送时间,不填则为立即发送,时间格式如>2011-11-11 11:11:11

* @param checkContent

* :选填--检查是否包含非法关键字,1--表示需要检查,0--表示不检查

* @param taskName

* :选填--任务名称,本次任务描述,100字内

* @param countNumber

* :选填--提交号码总数

* @param mobileNumber

* :选填--手机号码总数

* @param telephoneNumber

* :选填--小灵通(和)或座机总数

* @param sendType

* :选填--发送方式,默认为POST

* @param codingType

* :选填--发送内容编码方式,默认为UTF-8

* @param backEncodType

* :选填--返回内容编码方式,默认为UTF-8

* @return返回发送之后收到的信息

*/

public static String sendSms(String url, String userid, String account, String password, String mobile, String content, String action,

String sendTime, String checkContent, String taskName,

String countNumber, String mobileNumber, String telephoneNumber,

String sendType, String codingType, String backEncodType) {

try {

if (codingType == null || codingType.equals("")) {

codingType = "UTF-8";

}

if (backEncodType == null || backEncodType.equals("")) {

backEncodType = "UTF-8";

}

StringBuffer send = new StringBuffer();

if (action != null && !action.equals("")) {

send.append("action=").append(action);

} else {

send.append("action=send");

}

send.append("&userid=").append(userid);

send.append("&account=").append(

URLEncoder.encode(account, codingType));

send.append("&password=").append(

URLEncoder.encode(password, codingType));

send.append("&mobile=").append(mobile);

send.append("&content=").append(

URLEncoder.encode(content, codingType));

if (sendTime != null && !sendTime.equals("")) {

send.append("&sendTime=").append(

URLEncoder.encode(sendTime, codingType));

}

if (checkContent != null && !checkContent.equals("")) {

send.append("&checkContent=").append(checkContent);

}

if (taskName != null && !taskName.equals("")) {

send.append("&taskName=").append(

URLEncoder.encode(taskName, codingType));

}

if (countNumber != null && !countNumber.equals("")) {

send.append("&countNumber=").append(countNumber);

}

if (mobileNumber != null && !mobileNumber.equals("")) {

send.append("&mobileNumber=").append(mobileNumber);

}

if (telephoneNumber != null && !telephoneNumber.equals("")) { send.append("&telephoneNumber=").append(telephoneNumber);

}

if(sendType != null&& (sendType.toLowerCase()).equals("get")) {

return SmsClientAccessTool.getInstance().doAccessHTTPGet(

url + "?" + send.toString(), backEncodType);

} else {

return

SmsClientAccessTool.getInstance().doAccessHTTPPost(url,

send.toString(), backEncodType);

}

} catch (Exception e) {

e.printStackTrace();

return"未发送,编码异常";

}

}

/**

*

* POST方法

*

*

* @param sendUrl

* :访问URL

* @param paramStr

* :参数串

* @param backEncodType

* :返回的编码

* @return

*/

public String doAccessHTTPPost(String sendUrl, String sendParam, String backEncodType) {

StringBuffer receive = new StringBuffer();

BufferedWriter wr = null;

try {

if (backEncodType == null || backEncodType.equals("")) { backEncodType = "UTF-8";

}

URL url = new URL(sendUrl);

HttpURLConnection URLConn = (HttpURLConnection) url

.openConnection();

URLConn.setDoOutput(true);

URLConn.setDoInput(true);

((HttpURLConnection) URLConn).setRequestMethod("POST");

URLConn.setUseCaches(false);

URLConn.setAllowUserInteraction(true);

HttpURLConnection.setFollowRedirects(true);

URLConn.setInstanceFollowRedirects(true);

URLConn.setRequestProperty("Content-Type",

"application/x-www-form-urlencoded;charset=UTF-8");

URLConn.setRequestProperty("Content-Length", String

.valueOf(sendParam.getBytes().length));

DataOutputStream dos = new DataOutputStream(URLConn

.getOutputStream());

dos.writeBytes(sendParam);

BufferedReader rd = new BufferedReader(new InputStreamReader( URLConn.getInputStream(), backEncodType));

String line;

while ((line = rd.readLine()) != null) {

receive.append(line).append("\r\n");

}

rd.close();

} catch (java.io.IOException e) {

receive.append("访问产生了异常-->").append(e.getMessage());

e.printStackTrace();

} finally {

if (wr != null) {

try {

wr.close();

} catch (IOException ex) {

ex.printStackTrace();

}

wr = null;

}

}

return receive.toString();

}

2.4.3 https://www.doczj.com/doc/964003063.html,实例

以下实例仅供参考,可以根据需要自行进行处理加工或修改,如果需要技术支持,请联系软维技术

说明:https://www.doczj.com/doc/964003063.html,主要是针对下面的发送程序而言的,其中地址,参数均采用自定义的方式进行,所以跟上面一样的所有几乎雷同。注意采用的方式即可。以下实例仅供技术

余额,采用

http://114.112.64.134:8888/sms.aspx action为overage

相关主题
文本预览
相关文档 最新文档