打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
C# 后台模拟前台post发送json数据
 public static string PostMoths(string url, string param)    {        string strURL = url;        System.Net.HttpWebRequest request;        request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);        request.Method = "POST";        request.ContentType = "application/json;charset=UTF-8";        string paraUrlCoded = param;        byte[] payload;        payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);        request.ContentLength = payload.Length;        Stream writer = request.GetRequestStream();        writer.Write(payload, 0, payload.Length);        writer.Close();        System.Net.HttpWebResponse response;        response = (System.Net.HttpWebResponse)request.GetResponse();        System.IO.Stream s;        s = response.GetResponseStream();        string StrDate = "";        string strValue = "";        StreamReader Reader = new StreamReader(s, Encoding.UTF8);        while ((StrDate = Reader.ReadLine()) != null)        {            strValue += StrDate + "\r\n";        }        return strValue;    }
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
基于Web Service的客户端框架搭建一:C#使用Http Post方式传递Json数据字符串调用Web Service
HttpWebRequest HttpWebResponse 发送http请求
Post JSON data to RESTful datasnap server from delphi client [发布RESTful JSON数据从德尔福datasnap服务器端]
requests库快速入门(参照官方文档翻译整理)
python爬虫04 | 长江后浪推前浪,Reuqests库把urllib库拍在沙滩上
前后端联调之Form Data与Request Payload,你真的了解吗?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服