一些有用的API 之 飛信發短信

飛信API
<html>
<head runat="server">
<title>Send Message</title>
<script language="javascript" type="text/javascript">
function CreateXmlHttp()
{
if(window.ActiveXObject)
{
return new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
return new XmlHttpRequest();
}
}

function Confirm_onclick()
{
var myPhone = document.getElementById("MyPhoneNum").value;//$get("MyPhoneNum").value;
var myPWD = document.getElementById("MyPassword").value;//$get("MyPassword").value;
var otherPhone = document.getElementById("SelectOtherPhone").value;//$("SelectOtherPhone").options[$("SelectOtherPhone").selectedIndex].value;
var content = document.getElementById("Content").value;//$get("Content").value;
if(myPhone==""||myPWD==""||otherPhone==""||content=="")
{
alert(
"請填完資料");
return;
}


var ParamString = "username="+myPhone+"&password="+myPWD+"&sendto="+otherPhone+"&message="+content;
var url="https://sms.api.bz/fetion.php?";
encodeURIComponent(url);
var XmlHttpObject = CreateXmlHttp();
XmlHttpObject.onreadystatechange
= function(){
if(XmlHttpObject.readyState==4){
if(XmlHttpObject.status == 200){
alert(XmlHttpObject.responseText);
}
else if(XmlHttpObject.status==404){
alert(
"URL doesn't exists!");
}
else{
alert(
"Error:Status is "+XmlHttpObject.status);
}
}
}
XmlHttpObject.open(
"post",url,true);
XmlHttpObject.setRequestHeader(
"Content-Type","application/x-www-form-urlencoded;charset=utf-8");
XmlHttpObject.send(ParamString);
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
我的電話:
<input id="MyPhoneNum" type="text" value="15895663693"/><%--value中填寫你的手機號碼--%>
飛信密碼:
<input id="MyPassword" type="Password" value="changeme"/><%--value中填寫你的飛信號密碼--%>
對方號碼:
<select id="SelectOtherPhone">
<option value="15895663693">自己測試</option>
<option value="139********">老婆</option>
<option value="135********">老爸</option>
<option value="159********">老媽</option>
</select>
<br />
短信內容:
<textarea style="300px" rows="5" id="Content">祝自己開心~~</textarea>
<br />
<input id="Confirm" type="button" value="Send" onclick="return Confirm_onclick()" />
</div>
</form>
</body>
</html>
原文地址:https://www.cnblogs.com/takako_mu/p/1728533.html