posts - 66,comments - 41,trackbacks - 0
              項目中的OTA Server中的一個功能。具體使用請看https://www.clickatell.com/developers/api_http.php
              代碼如下:

           1  protected void SendSMS()
           2     {
           3 
           4         string api_id = "xxxxxx";//api_id請查閱clicktell網站幫助
           5         string user = "xxxxxx";
           6         string password = "xxxxx";
           7         //string mobile = "xxxxxx";
           8         string mobile = txtMobile.Text;//一個輸入手機號的文本框
           9 
          10         string appUri = getAppUri();//發送給手機的App鏈接,出于保密,此處假設了getAppUri()方法
          11 
          12         StringBuilder smsParams = new StringBuilder();
          13         smsParams.Append("api_id=" + api_id);
          14         smsParams.Append("&user=" + user);
          15         smsParams.Append("&password=" + password);
          16         smsParams.Append("&to=" + mobile);
          17         smsParams.Append("&text=" + appUri);
          18 
          19 
          20 
          21         Uri smsuri = new Uri(string.Format("http://api.clickatell.com/http/sendmsg?{0}", smsParams));
          22 
          23         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(smsuri);
          24 
          25         request.AllowAutoRedirect = false;
          26 
          27         request.Method = "GET";
          28 
          29 
          30         HttpWebResponse response = (HttpWebResponse)request.GetResponse();
          31 
          32     }
          33 
          34 
          這個方法不僅適用于clicktell公司的服務,其它的一些SMS服務提供商,用C#調用方法也差不多,僅供大家參考,呵呵



          MSN:
          posted on 2009-07-16 21:52 kylixlu 閱讀(229) 評論(0)  編輯  收藏 所屬分類: dotNet
          主站蜘蛛池模板: 融水| 天祝| 镇雄县| 惠安县| 长岭县| 祥云县| 屯留县| 金堂县| 五家渠市| 义乌市| 黄冈市| 鸡泽县| 滦平县| 建瓯市| 舒城县| 奉新县| 石台县| 闸北区| 平谷区| 西宁市| 井陉县| 通河县| 吉木乃县| 汉沽区| 红河县| 庆元县| 凉山| 观塘区| 澄迈县| 巴林右旗| 綦江县| 怀柔区| 福泉市| 平山县| 平江县| 彭山县| 大姚县| 页游| 澳门| 仙游县| 望都县|