asp.net調用飛信免費發簡訊(測試有效)_實用技巧

來源:互聯網
上載者:User
複製代碼 代碼如下:

#region 免費發送飛們介面(2014-01-06 16:20測試有效)
/// <summary>
/// 免費發送飛們介面(要開通飛信把對方加為好友才能發,也可以給自己發做測試)
/// </summary>
/// <param name="sendNumber">登陸飛信手機號</param>
/// <param name="sendPassword">登陸密碼</param>
/// <param name="receiveNumber">接收手機</param>
/// <param name="Content">簡訊內容</param>
/// <returns></returns>
public bool sendfetion(string sendNumber, string sendPassword, string receiveNumber, string Content)
{

string url = string.Format("https://quanapi.sinaapp.com/fetion.php?u={0}&p={1}&to={2}&m={3}", sendNumber, sendPassword, receiveNumber, HttpUtility.UrlEncode(Content));
string strRet = "";
try
{
HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(url);
hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
hr.Method = "GET";
hr.Timeout = 30 * 60 * 1000;
WebResponse hs = hr.GetResponse();
Stream sr = hs.GetResponseStream();
StreamReader ser = new StreamReader(sr, Encoding.Default);
strRet = ser.ReadToEnd();
}
catch (Exception er)
{
strRet = "";
}
if (!strRet.Contains(":0")) return false;//成功時返回資料:{"result":0,"message":"\u53d1\u9001\u6210\u529f"}
return true;
}
#endregion

介面是搭建在SinaAppEngine上的,SAE的服務還算是比較牢靠的。
寄件者使用者、密碼不要寫錯,然後接收者必須是自己或者飛信好友,才能發送成功。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.