开发者

c# .NET Screen Scraping with Inputs

I want to screen scrape the following website using C# Co开发者_JS百科mpact Framework because I don't think there is a publicly available api for it (I could be wrong). It has several controls on it that I want to set values for before submitting the page and moving on to the next form full of controls. How can I go about doing this. Other posts don't really talk about how to set input values.

http://www.tfl.gov.uk/tfl/tickets/refunds/tuberefund/

I understand how to get the page HTML using HttpWebRequest or WebClient but not how to edit the page and post it back.


In my opinion, you might be better off if you used a browser plugin and/or a wireshark trace to trace the HTTP requests being sent by the browser when you do your scenario manually, and then replicate that network session exactly using code.

Parsing controls and coming up with POSt requests to simulate forms submit is also doable, but is a lot more work.

Also you might look to see if that website exposes any REST or Webservice apis that give you the capability you need to solve your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜