短信營銷接口文檔 點(diǎn)擊下載
短信營銷接口接入指南 點(diǎn)擊訪問
string[] strArray = PhoneNO.Split(','); //字符串轉(zhuǎn)數(shù)組
string uuid = System.Guid.NewGuid().ToString("N");
DateTime startTime = TimeZoneInfo.ConvertTimeToUtc(new DateTime(1970, 1, 1, 8, 0, 0));//北京所在東八區(qū)
DateTime endTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes("api_id=" + select3[7].Value + "&api_key=" + select3[8].Value + "&request_id=" + uuid + "×tamp=" + Convert.ToInt64((endTime - startTime).TotalSeconds) + ""));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));//轉(zhuǎn)化為小寫的16進(jìn)制
}
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(PostUrl);
myRequest.Method = "POST";
myRequest.ContentType = "application/json";
using (var streamWriter = new StreamWriter(myRequest.GetRequestStream()))
{
string json = new JavaScriptSerializer().Serialize(new
{
api_id = select3[7].Value,
signature = sBuilder.ToString(),
timestamp = Convert.ToInt64((endTime - startTime).TotalSeconds),
request_id = uuid,
product_id = 1018,
phone = strArray,
sign_name = "簽名名稱",
content = Name
});
streamWriter.Write(json);
}
var response = (HttpWebResponse)myRequest.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string res = reader.ReadToEnd();
}
else
{
//訪問失敗
}
驗(yàn)證碼已發(fā)送到您的手機(jī),請查收!
輸入驗(yàn)證碼后,點(diǎn)擊“開通體驗(yàn)賬戶”按鈕可立即開通體驗(yàn)賬戶。