zoukankan      html  css  js  c++  java
  • 发起post请求

      

    string postUrl = "https://api.mch.weixin.qq.com/mmpaymkttransfers/gethbinfo";
    //string requestStr= Utils.DCUtils.HttpPost(postUrl,HttpUtility.UrlEncode(requestXml));
    //string requestStr = Utils.DCUtils.HttpPost(postUrl,"xml="+requestXml);

    #region 发起post请求
    HttpWebRequest webrequest = (HttpWebRequest)HttpWebRequest.Create(postUrl);
    //webrequest.ClientCertificates.Add(cer);
    webrequest.Method = "post";

    byte[] postdatabyte = Encoding.UTF8.GetBytes(requestXml);
    webrequest.ContentLength = postdatabyte.Length;
    Stream stream;
    stream = webrequest.GetRequestStream();
    stream.Write(postdatabyte, 0, postdatabyte.Length);
    stream.Close();

    HttpWebResponse httpWebResponse = (HttpWebResponse)webrequest.GetResponse();
    StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream());
    string requestStr = streamReader.ReadToEnd();
    #endregion

  • 相关阅读:
    富文本
    管理员状态
    分页
    tp。3.2中的模板基础
    get和post之间的区别
    RegExp
    获取各种类型的节点
    节点的层次关系
    创建元素节点
    JavaScript 正则
  • 原文地址:https://www.cnblogs.com/james641/p/4980517.html
Copyright © 2011-2022 走看看