public string GetPost(string url, params string[] data)
        {
            string tempMessage = "";
            System.Net.WebClient WebClientObj = new System.Net.WebClient();
            System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection();
            if (data.Length % 2 == 0)
            {
                for (int i = 0; i < (data.Length / 2); i++)
                {
                    PostVars.Add(data[i * 2], data[i * 2 + 1]);
                }
            }

            try
            {
                byte[] byRemoteInfo = WebClientObj.UploadValues(url, "POST", PostVars);
                //下面都没用啦,就上面一句话就可以了
                tempMessage = System.Text.Encoding.Default.GetString(byRemoteInfo);
                //这是获取返回信息

            }
            catch
            {

            }
            return tempMessage;

 

        }

相关文章:

  • 2022-12-23
  • 2021-11-12
  • 2021-11-16
  • 2022-12-23
  • 2021-12-18
  • 2019-08-26
  • 2021-05-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2021-06-25
  • 2021-10-13
  • 2022-12-23
  • 2022-02-20
相关资源
相似解决方案