. C # & Net dry goods share - construction SMSWebChineseApi docking third party messaging platform

You want SMS butt, you must be willing to money oh. . . .

 

    /// <Summary>
    /// http://sms.webchinese.cn/api.shtml
    /// </ Summary>
    public class SMSWebChineseApi
    {
        Private String SMS_UID = string.Empty; // username
        private string SMS_KEY = string .Empty; // Interface keys

        Private the Dictionary <String, String> = new new dcReurnKeyValue the Dictionary <String, String> ()
        {
        { "-1", "without the user account"},
        { "-2", "dense Interface key is not correct, not the account login password "},
        {" -21 "," Interface MD5 encryption key is incorrect "},
        {" 3 "," insufficient number of text messages "},
        {" -11 "," the user disabled "},
        {" -14 "," SMS content appears illegal character "},
        {" 4 "," phone number is not formatted correctly "},
        { "-41", "phone number is empty"},
        { "-42", "SMS is empty"},
        { "-51", "SMS signature format is incorrect, the interface signature format: [Signed Content] "},
        }         /// <Summary>         when /// call makes up the URL need only pass to the function. The return value can be determined

















        /// </ Summary>
        /// <param name = "receivePhoneNumber"> object of the phone number (s phone number should be separated with commas) </ param>
        /// <param name = "receiveSms"> SMS content It supports up to 400 words, 70 words regular SMS / strips, 64 words long message / article billing </ param>
        /// <Returns> </ Returns>
        public String SendWebChineseSmsInfo (receivePhoneNumber String, String receiveSms)
        {
            String = GetPostUrl posturl (receivePhoneNumber, receiveSms);
            String strReturnMsg = string.Empty;
            IF (String.IsNullOrEmpty (posturl))
            {
                return strReturnMsg;
            }
            String targetUrl = postUrl.Trim () the ToString ();.
            the try
            {
                HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(targeturl);
                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);
                strReturnMsg = ser.ReadToEnd();
            }
            catch
            {
                strReturnMsg = null;
            }
            if (string.IsNullOrEmpty(strReturnMsg))
            {
                return string.Empty;
            }
            if (dcReurnKeyValue.Keys.Contains(strReturnMsg))
            {
                return dcReurnKeyValue[strReturnMsg];
            }
            else
            {
                return dcReurnKeyValue["大于0"] + strReturnMsg;
            }
        }
    }

Guess you like

Origin www.cnblogs.com/hualiuliu/p/11458133.html