www.gusucode.com > 爱美尔女性商城源码 1.0源码程序 > sms.asp

    <%
	Account = "yijia"			
	Password = "123456"

%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>短信发送</title>
<style type="text/css">
table{ font-size:12px; color:#333333;}
.xhinput{border-bottom:#CCCCCC 1px solid;}
textarea{border:#CCCCCC 1px solid;}
.STYLE1 {font-size: 18px}
</style>
</head>
<body>
<%
if request("action")="ceshi" then


	Content=Trim(Request.Form("msg"))
	Phone=Trim(Request.Form("Phone")) 
	'SendTime=Trim(Request.Form("SendTime"))
	
	
		If SendSms(Phone,Message,SendTime) Then
			'与网关通讯成功
			If SendSmsMsg >= 0 Then
				'发送短信成功,返回发送条数,可进一步做成功后续处理
				response.write "发送成功:"&SendSmsMsg
				'response.end
			Else
				'发送失败,返回错误代码,可进一步做成功后续处理
				response.write "发送失败:"&SendSmsMsg
				'response.end
			End if
		response.write "<br>如果返回失败代码为-7,则是测试账户余额已经用完,请联系管理员充值"
		response.write "<br>接收号码:"&Phone
		response.write "<br>短信内容:"&Content
		response.end
		End If



else
%>

<form id="form1" name="form1" method="post" action="?action=ceshi">
<table width="600" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699CC">
  <tr>
    <th height="50" colspan="3" scope="col"><div align="center" class="STYLE1">宜家免费短信发布平台</div>      
      <div align="center"></div>      <div align="center"></div></th>
  </tr>
  <tr>
    <td align="right" bgcolor="#FFFFFF">接收号码:</td>
    <td bgcolor="#FFFFFF">
      <label>
        <input name="Phone" type="text" id="Phone"  class="xhinput"/>
        </label>

    </td>
    <td bgcolor="#FFFFFF">请输入接收的手机号码</td>
  </tr>
  <tr>
    <td align="right" bgcolor="#FFFFFF">发送内容:</td>
    <td bgcolor="#FFFFFF"><label>
      <textarea name="msg" cols="30" rows="4" id="msg"></textarea>
      </label></td>
    <td bgcolor="#FFFFFF">输入短信内容(请输入少于140字)</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><label>
      <input type="submit" name="Submit" value="发送"/>
    </label></td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
</form>
<%
end if

%>
<%
Dim SendSmsMsg	


'------------以下是处理函数片段---------------
Function SendSms(Phone,Message,SendTime)
	set http = Server.CreateObject("Microsoft.XMLHTTP")
'http.Open "GET", "http://59.36.99.205/dl/person/SendSms?Account="& Account &"&Password="& Password &"&Phone="&Phone&"&Content="&server.UrlEncode(Content)&"&SendTime="&SendTime&"",false
http.Open "GET", "http://59.36.99.205/dl/person/SendSms?Account="& Account &"&Password="& Password &"&Phone="&Phone&"&Content="&Content&"&SendTime="&SendTime&"",false


	http.setRequestHeader "Content-type:", "text/xml;charset=utf-8"
	http.Send
	   msg=http.ResponseText
	   msg=RemoveHTML(msg)
		If IsNumeric(msg)=True Then
			SendSmsMsg = Int(msg)
			SendSms = True
		Else
			SendSmsMsg = 0
			SendSms = False
		End if
    	set http = Nothing
End Function

Function RemoveHTML(strHTML)
'------------------------
'函数说明:过滤XML文档标签
'最后修改:2007-04-15
'By Chener
'------------------------

 Dim objRegExp, Match, Matches 
 Set objRegExp = New Regexp
 
 objRegExp.IgnoreCase = True
 objRegExp.Global = True
 objRegExp.Pattern = "<.+?>"
 Set Matches = objRegExp.Execute(strHTML)
 
 For Each Match in Matches 
 strHtml=Replace(strHTML,Match.Value,"")
 Next
 RemoveHTML=strHTML
 Set objRegExp = Nothing
End Function



%>
</body>
</html>