复制代码 代码如下:
#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的服务还算是比较牢靠的。
发送者用户、密码不要写错,然后接收者必须是自己或者飞信好友,才能发送成功。
#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的服务还算是比较牢靠的。
发送者用户、密码不要写错,然后接收者必须是自己或者飞信好友,才能发送成功。
标签:
asp.net,飞信,发短信
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“asp.net调用飞信免费发短信(测试有效)”评论...