日期:2014-05-18  浏览次数:20430 次

CS里怎么向URL提交数据 POST方式
在CS里怎么向URL提交数据 而且是以POST的方式?



------解决方案--------------------
C# code
            string html = null;
            string url = "http://china.alibaba.com/keyword/promotion.htm?catId=14";
            WebRequest req = WebRequest.Create(url);
            req.Method = "POST";
            WebResponse res = req.GetResponse();
            Stream receiveStream = res.GetResponseStream();
            Encoding encode = Encoding.GetEncoding("gb2312");
            StreamReader sr = new StreamReader(receiveStream, encode);
            char[] readbuffer = new char[256];
            int n = sr.Read(readbuffer, 0, 256);
            while (n > 0)
            {
                string str = new string(readbuffer, 0, n);
                html += str;
                n = sr.Read(readbuffer, 0, 256);
            }
            System.Console.Write(html);

------解决方案--------------------
传递数据看看这个
http://blog.163.com/zhangqing_007@126/blog/static/37360989200981052745903/
------解决方案--------------------
ls的比较详细++
------解决方案--------------------
mngzilin 这个讲的很详细,赞一个.