大家好!我在做个采集程序,程序是这样先从一个页面获取一个值(按钮的ID值),在POST 提交到另一个页面,我的代码是
          string uriString = "http://www.xxx.com.cn/xxx.html";   //要提交的页面

            WebClient myWebClient = new WebClient();

            string postData = "server=1696&Submit2=%CF%C2%B5%A5";


            myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
          
            myWebClient.Headers.Add("Referer", "http://www.xxx.com.cn");

            myWebClient.Headers.Add("Cookie", "lastrequest=j2FuSEFJVNQmz4Wu2tZWvpCnq;PHPSESSID=caef0bb7f1e19caf767c323da8f6cacd");
     
            byte[] byteArray = Encoding.Unicode.GetBytes(postData);
           
            byte[] responseArray = myWebClient.UploadData(uriString, "POST", byteArray);

            string sonPageInfo = Encoding.UTF8.GetString(responseArray);

            GetRemoteObj o = new GetRemoteObj();

            string s = o.ReplaceEnter(sonPageInfo);

但是S 返回的的值不是我要的http://www.xxx.com.cn/xxx.html的代码 ,他所返回的是加载那个页面,一直在加载中,获不到我要的值,想请大家帮我看看,我的代码错在哪了,为什么获不到我要的值?谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

posted on 2007-08-16 11:44  wbscn  阅读(198)  评论(0)    收藏  举报