您的位置:首页 > 编程语言 > ASP

使用ASP发送飞信的免费短信

2012-05-16 08:59 537 查看
要实现在asp网站上发送飞信,要求是中国移动的手机用户,并且开通移动飞信功能。

使用以下asp代码,修改参数为你的手机号及飞信密码,就可以实现在网站发免费短信功能。

fsend.asp文件源代码如下:

<%

Dim fno,fp,tofno,rurl

fno="138xxxxxxxx" '手机号

fp="xxxxxxxx" '飞信密码

tofno="137xxxxxxxx" '发送目标手机号(要求是自己的号码或飞信好友)

rurl="" '提交后转移到的目标地址(留空将不转移)

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>请留下你的联系信息</title>

</head>

<body style="font-size: 10pt; font-family: 宋体">

<%if (Request("msg")="") then%>

<form method="POST" action="fsend.asp">

<br>请留下你的联系信息<br>

<hr>

联系信息:<br><textarea rows="5" name="msg" cols="27"></textarea><br>

<p><input type="submit" value="提交" name="B1"></p>

</form>

<%

else

Dim returnString

Dim msg

msg=Request("msg")

returnString=sendf(fno,fp,tofno,msg)

if rurl="" then

Response.Write returnString&"<br><a href='fsend.asp'>返回</a>"

else

Response.Redirect rurl

end if

end if

%>

</body>

</html>

<%

function sendf(fno,fp,tofno,msg)

'函数参数说明:fno=登录手机号,fp=登录密码,tofno=目标手机号,msg=要发送的信息

Dim returnString

Dim SoapRequest

Dim SoapURL

SoapURL = "http://io.feirobot.cn/send.aspx?fno="&fno&"&fp="&fp&"&tofno="&tofno&"&msg="&msg

Set SoapRequest = Server.CreateObject("MSXML2.XMLHTTP")

SoapRequest.Open "GET",SoapURL,False

SoapRequest.Send

returnString=bytes2bstr(SoapRequest.responsebody)

sendf=returnString

end function

function bytes2bstr(vin)

strreturn = ""

for i = 1 to lenb(vin)

thischarcode = ascb(midb(vin,i,1))

if thischarcode < &h80 then

strreturn = strreturn & chr(thischarcode)

else

nextcharcode = ascb(midb(vin,i+1,1))

strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))

i = i + 1

end if

next

bytes2bstr = strreturn

end function

%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: