码迷,mamicode.com
首页 > 其他好文 > 详细

后台post请求

时间:2016-06-07 10:01:29      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        System.Net.WebClient client = new System.Net.WebClient();
        client.Headers.Add("Accept_Language", "zh-cn");
        client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
        var name = new System.Collections.Specialized.NameValueCollection();
        name.Add("action", "send");//固定
        name.Add("userid", "");//公司id
        name.Add("account", "******");//接口账号
        name.Add("password", "****");//接口密码
        name.Add("mobile", "***");//接收短信的手机
        name.Add("content", "12345【公司名称】");
        name.Add("sendTime", "");//发送时间
        name.Add("extno", "");//扩展码
        byte[] buffer = client.UploadValues("http://dx.ipyy.net/smsJson.aspx", "post", name);
        string str = System.Text.Encoding.UTF8.GetString(buffer);
        context.Response.Write(str);
    }

 

后台post请求

标签:

原文地址:http://www.cnblogs.com/6654-cui/p/5565991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!