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;

 

        }

posted on 2010-10-18 11:41 sanmao 阅读(281) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问  
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜