(已解决by-lele2007)大题一:利用飞信API接口实现新订单免费提醒
[local]1[/local]酒店预订网站,ASP语言的
飞信的接口是:http://sms.api.bz/fetion.php?username=号码&password=密码&sendto=号码&message=内容
只要触发这个链接就能发送短信通知到我
如图所示,想让点击预订按钮的时候,自动触动这个链接,并且不影响正常的页面跳转
不知道代码该加在哪里,该怎么写
希望各位高手能帮帮忙
预订页面的部分代码如下:
程序代码:
<% Dim Action Action=Request("action") If Request.ServerVariables("REQUEST_METHOD") = "POST" and Action="add" Then HotelID=Request("HotelID") RoomID=Request("RoomID") RoomName=Request("RoomName") Price=Request("Price") if Session("UserName")<>"" then UserName=Session("UserName") else UserName="未注册用户" end if Session("OrderNo")="" OrderNo=replace(now(),"-","") OrderNo=replace(OrderNo,":","") OrderNo=replace(OrderNo," ","") Session("OrderNo")=OrderNo PersonNum=Request("sel1") RoomNum=Request("sel2") ConfirmType=Request("sel3") RoomSave=Request("sel4") Start_Time=Request("Start_Time") End_Time=Request("End_Time") GuestName=left(Trim(Request("GuestName")),100) ContactName=left(Trim(Request("ContactName")),50) Mobile=left(Trim(Request("Mobile")),50) Telephone=left(Trim(Request("Telephone")),50) Fax=left(Trim(Request("Fax")),50) Email=left(Trim(Request("Email")),150) City=left(Trim(Request("City")),50) OtherContent=left(Trim(Request("OtherContent")),120) set rs=server.CreateObject("adodb.recordset") sql="select * from DB_Order" rs.open sql,conn,1,3 rs.addnew() rs("OrderNo")=OrderNo rs("UserName")=UserName rs("Hotel_ID")=HotelID rs("Room_ID")=RoomID rs("RoomName")=RoomName rs("RoomPrice")=Price rs("PersonNum")=PersonNum rs("RoomNum")=RoomNum rs("ConfirmType")=ConfirmType rs("RoomSave")=RoomSave rs("Start_time")=Start_time rs("End_time")=End_time rs("GuestName")=GuestName rs("ContactName")=ContactName rs("Mobile")=Mobile rs("Telephone")=Telephone rs("Fax")=Fax rs("Email")=Email rs("City")=City rs("OtherContent")=OtherContent rs("Score")=int((Price/10))+10 rs.update() rs.close set rs=nothing response.Write("<script>alert('恭喜您,预订酒店成功,请记录您的订单号\n订单号:"&OrderNo&"\n请确保您预订时的联系人和联系电话准确\n以确保顺利进行订单查询.');location.href='javascript:copyToClipBoard()';</script>") response.End() end if conn.close set conn=nothing %>-----------------------------
-----------------------------
-----------------------------
-----------------------------
-----------------------------
问题已经解决!是lele2007帮我解决的!
最终的短信发送部分代码是:
程序代码:
response.Write("<script>alert('恭喜您,预订酒店成功,请记录您的订单号\n订单号:"&OrderNo&"\n请确保您预订时的联系人和联系电话准确\n以确保顺利进行订单查询.');location.href='javascript:copyToClipBoard()';</script>") '开始发送飞信短信 '-----------------------------------------我是谁?我是分割线---------------------------------------- concent=""&OrderNo concent=concent&"hotelname:"&HotelID concent=concent&"roomname:"&RoomName concent=concent&"price:"&Price concent=concent&"contactname:"&ContactName concent=concent&"mobile:"&Mobile dim xmlhttp,url url="http://sms.api.bz/fetion.php?username=15XXXXXXX&password=XXXX&sendto=150XXXXXX&message="&concent&"" set xmlhttp = server.CreateObject("MSxml2.XMLHTTP") xmlhttp.open "get",url,false xmlhttp.send() set xmlhttp = nothing response.End() end if conn.close set conn=nothing %>
[ 本帖最后由 jiazehua 于 2010-8-17 16:01 编辑 ]