短信接口代码接入示例(C#)
- 2016-03-10 17:30:24
- admin
- 2635
- 最后编辑:roadmzhang 于 2016-04-10 13:57:24
string postString = "spId=123&loginName=xxxxx&password=xxxx&content=测试内容&mobiles=13712345678&subPort=";//这里即为传递的参数
byte[] postData = Encoding.GBK.GetBytes(postString);//编码,尤其是汉字,事先要看下抓取网页的编码方式
string url = "http://www.ems88.cn:8080/sms/Send.do";//接口地址
WebClient webClient = new WebClient();
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");//采取POST方式必须加的header,如果改为GET方式的话就去掉这句话即可
byte[] responseData = webClient.UploadData(url, "POST", postData);//得到返回字符流
string srcString = Encoding.UTF8.GetString(responseData);//解码 发表评论
Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.