Post HTTPwebrequest映像单击发布

Post HTTPwebrequest映像单击发布,post,httpwebrequest,scrape,Post,Httpwebrequest,Scrape,因此,我试图通过首先单击下拉列表中的一个项目来导航。使用以下命令过帐下拉列表中的值后: string poststring = String.Format("Cat1={0}", "7"); CookieContainer cookie = new CookieContainer(); HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create("http://www.historicflyingclothing.com/shop

因此,我试图通过首先单击下拉列表中的一个项目来导航。使用以下命令过帐下拉列表中的值后:

string poststring = String.Format("Cat1={0}", "7");
CookieContainer cookie = new CookieContainer();
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create("http://www.historicflyingclothing.com/shop.php");

httpRequest.Method = WebRequestMethods.Http.Post;
httpRequest.CookieContainer = cookie;
httpRequest.AllowWriteStreamBuffering = true;
httpRequest.ProtocolVersion = HttpVersion.Version11;
httpRequest.AllowAutoRedirect = true;
httpRequest.ContentType = "application/x-www-form-urlencoded";

byte[] bytedata = Encoding.UTF8.GetBytes(poststring);
httpRequest.ContentLength = bytedata.Length;

Stream requestStream = httpRequest.GetRequestStream();
requestStream.Write(bytedata, 0, bytedata.Length);
requestStream.Close();


HttpWebResponse httpWebResponse = (HttpWebResponse)httpRequest.GetResponse();
Stream responseStream = httpWebResponse.GetResponseStream();
我能够得到页面上的项目。 问题是我什么时候需要单击“下一步”按钮。我希望使用
CookieContainer
来帮助我导航,但我不知道post数据应该是什么。下一次单击的html代码为:

<form method="POST" class="shopform" action="shop.php"> 
    <p style="text-align: center"> <input type="IMAGE" name="Submitnext" src="buttons/next.gif" value="npage" style="margin-bottom: -4pt"></p>
</form>


下拉列表中的名称为“Cat1”,值为“7”,但我如何使用此图像?

从您提供的HTML中,您需要发布的值为:

Submitnext=npage


您会注意到您发布的名称包含在“name”属性中,值包含在“value”属性中。

我编辑了您的格式,因为您的HTML不可见,这可能会阻止您更快获得答案。将来,您可能希望确保问题的格式正确。