日期:2014-05-18  浏览次数:20451 次

新手高分求asp.net通过http短信网关发送手机短信代码!在线...
在网页上通过http短信网关实现手机短信发送,服务商给出了url接口格式例子:
发送短信url:
http://smshttp.xunsai.com/dll/http/sendfordll/dll_send.php?uid=test0204&pwd=123456&rev=13330905696;&cnt=1&keyward=kwd000;&msg=你好!短信测试&sdt=SOON&cpn=xunsaiapi

发送短信结果查询url:
http://smshttp.xunsai.com/dll/http/sendfordll/dll_getreport.php?uid=test0204&pwd=123456&cnt=1&keyward=kwd000&cpn=xunsaiapi
返回(0:成功,-1:发送失败,p:无效的手机号码)

请问我该怎么用上述2个url来在网页中实现发送短信息,并查询和显示结果,第一次做这东西,希望有个经验的给个源代码!!
在线等......!解决立马结贴!!谢谢!!!


------解决方案--------------------
构造参数,很简单的不说了
------解决方案--------------------
分不在高,有代码则行
------解决方案--------------------
按照他的格式get方式传送过去,
然后用xmlhttp取返回值,判断是否发送成功了.

.net下好像有个webrequest什么的,偶是.net新手:)
------解决方案--------------------
private string PostData(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "text/html; charset=UTF-8 ";
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR 2.0.50727) ";
request.AllowAutoRedirect = false;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding( "UTF-8 "));
string s = sr.ReadToEnd();
return s;
}
string url= "http://smshttp.xunsai.com/dll/http/sendfordll/dll_send.php?uid=test0204&pwd=123456&rev=13330905696;&cnt=1&keyward=kwd000;&msg=你好!短信测试&sdt=SOON&cpn=xunsaiapi ";
PostData(url);