如何发送包括T& C的短信? [英] How to send sms which including T&C?
本文介绍了如何发送包括T& C的短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的文字
尊敬的会员,您的3000积分将于31-08-2017到期。将它们与3000交换点一起兑换为忠诚利益以购买新车。请访问离您最近的经销商或www.marutiautocard.com进行兑换。 T& C适用。
但是当我发送短信时我只收到
尊敬的会员,您的3000积分将于2017年8月31日到期。将它们与3000交换点一起兑换为忠诚利益以购买新车。请访问离您最近的经销商或www.marutiautocard.com进行兑换。 T
在T之后留下字符
我是什么尝试过:
ret = String.Empty
Dim w As WebRequest = WebRequest.Create(http: //180.179.104.9/smspush-enterprise/api/push)
System.Net.ServicePointManager.Expect100Continue = False
w.Method =POST
w.ContentType =application / x-www-form-urlencoded
Dim AutoCardSenderName As String =MARUTI
使用writeStream As Stream = w.GetRequestStream()
Dim encoding As UTF8Encoding = New UTF8Encoding( )
'MSG = MSG.Replace(&,&)
Dim bytes()As Byte = encoding.GetBytes(accesskey = SKt8r0w7Q3OI8rZUWLwiANpbDpLCt2& to =+ mobileno +& ; text =+ MSG +& from =& AutoCardSenderName
writeStream.Write(bytes,0,bytes.Length)
End using
使用r作为HttpWebResponse = w.GetResponse()
使用responseStream作为Stream = r.GetResponseStream()
使用readStream作为新的StreamReader(responseStream,Encoding.UTF8)
ret = readStream.ReadToEnd( )
如果ret.ToUpper()。包含(SUCCESS)= True则
boolStatus = True
结束如果
结束使用
结束使用
结束使用
Catch ex As Exception
boolStatus = False
ret = ex.Message
最后
结束尝试
返回boolStatus
结束函数
解决方案
由于你是通过html发送的,你应该编码特殊字符,即&
=& amp;
(没有空格 - 编辑器在这里更改它)
HTML代码 - ascii字符和符号表 [ ^ ]
Here is my text
Dear Member, your 3000 Points will expire on 31-08-2017. Redeem them along with the 3000 exchange points as loyalty benefit to buy a new car. Visit your nearest dealership or www.marutiautocard.com to redeem. T&C apply.
but when i send sms I receive only
Dear Member, your 3000 Points will expire on 31-08-2017. Redeem them along with the 3000 exchange points as loyalty benefit to buy a new car. Visit your nearest dealership or www.marutiautocard.com to redeem. T
It left tcharacters after T
What I have tried:
ret = String.Empty Dim w As WebRequest = WebRequest.Create("http://180.179.104.9/smspush-enterprise/api/push") System.Net.ServicePointManager.Expect100Continue = False w.Method = "POST" w.ContentType = "application/x-www-form-urlencoded" Dim AutoCardSenderName As String = "MARUTI" Using writeStream As Stream = w.GetRequestStream() Dim encoding As UTF8Encoding = New UTF8Encoding() 'MSG = MSG.Replace("&", "&") Dim bytes() As Byte = encoding.GetBytes("accesskey=SKt8r0w7Q3OI8rZUWLwiANpbDpLCt2&to=" + mobileno + "&text=" + MSG + "&from=" & AutoCardSenderName) writeStream.Write(bytes, 0, bytes.Length) End Using Using r As HttpWebResponse = w.GetResponse() Using responseStream As Stream = r.GetResponseStream() Using readStream As New StreamReader(responseStream, Encoding.UTF8) ret = readStream.ReadToEnd() If ret.ToUpper().Contains("SUCCESS") = True Then boolStatus = True End If End Using End Using End Using Catch ex As Exception boolStatus = False ret = ex.Message Finally End Try Return boolStatus End Function
解决方案
Since you are sending via html you should encode the special characters i.e.&
=& amp ;
(without the spaces - the editor here changes it)
HTML Codes - Table of ascii characters and symbols[^]
这篇关于如何发送包括T& C的短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文