模拟表单发送数据.
我用下面的方法抓取网页,但是有的网站是看不到参数的,那么在DataPost中就无法写了啊.
HttpWebRequest MyRequest1 = (HttpWebRequest)WebRequest.Create( "http://www.anywho.com/qry/wp_fap ");
ServicePointManager.DefaultConnectionLimit = 5;
string DataPost1 = " ";
ASCIIEncoding myEcoding1 = new ASCIIEncoding();
byte[] Byte1 = myEcoding1.GetBytes(DataPost1);
MyRequest1.ContentType = "application/x-www-form-urlencoded ";
MyRequest1.Method = "post ";
MyRequest1.ContentLength = DataPost1.Length;
Stream NewStream1 = MyRequest1.GetRequestStream();
NewStream1.Write(Byte1, 0, Byte1.Length); //sending request to the web, if network unavailable, will jump to catch throws...
NewStream1.Close();
示例网站:http://www.anywho.com/qry/wp_fap
在LastName里输入smith, zipcode输入11233,search之后它的URL还是http://www.anywho.com/qry/wp_fap, 那么就没有办法获取search之后的网页内容了啊
------解决方案--------------------http://dotnet.aspx.cc/article/atv1glxt-65ff-4m82-ct5u-b1j65d3zn2ok/read.aspx
------解决方案--------------------比如
<form action= 'url ' method = 'post '>
<td name=name value= 'test '> </td>
<input name=input>
</form>
参数形势就是name=test&input=输入
------解决方案--------------------用抓包工具直接看发送的数据
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
最新版本:20070212
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html