Webrequest-哪些数据和目标? [英] Webrequest - what data and target?
问题描述
大家好,
我想使用webrequest或httpwebrequest登录并在网站上做一些事情.尽管我以前没有做过,但我了解有关如何执行此操作的基本理论.
主要问题是我不知道目标网页或POST提交什么数据.好的,我确实知道数据没有配置.
有什么方法可以监视离开我的机器的POST请求,以便我可以确定请求的去向以及可能正在发送的数据?
我今天下午尝试了一些数据包嗅探器,但它们似乎只监视GET而不监视POST,虽然可以理解,但很烦人.
感谢您的帮助.
Arthur
Hello folks,
I want to use webrequest or httpwebrequest to login and do some stuff on a website. I understand the basic theory on how to do this, although I haven''t done it before.
The main problem is that I don''t know which web page is being targeted or what data the POST is submitting. OK, I do know the data put not how to configure it.
Is there some way to monitor the POST request that leaves my machine so I can identify where the request is going and perhaps the data it is sending?
I have tried a few packet sniffers this afternoon but they only seem to monitor the GET and not the POST, which whilst understandable, is annoying.
Thanks for the help.
Arthur
推荐答案
HttpWebRequest
类具有Method
属性,默认为"GET
",但也可以为"POST
".在相关的MSDN页面上有一个示例.
:)
Hi,
TheHttpWebRequest
class has aMethod
property that defaults to "GET
" but also could be "POST
". There is an example on the relevant MSDN page.
:)
如果我对您的理解正确,那么您想查看浏览器发送的请求,然后使用WebRequest
模仿它们吗?
数据包嗅探器是一种方法,但这将需要大量工作.顺便说一句:对于GET和POST请求,所有HTTP通信都在端口80上(HTTPS在端口443上).区别仅在于HTTP标头.
使用与目标站点相同的技术编写一个小型网站,并查看浏览器向该站点发送的请求,可能会更容易.您可能学到了足够的知识,可以猜测给定事件将发送到目标站点的内容.
最后,如果页面太复杂,则基本上必须编写一个浏览器用户代理.您要为此付出多少努力?
从这里开始:
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol [
If I understand you correctly, you want to look at the requests a browser sends and then mimic them with aWebRequest
?
A packet sniffer is one way, but it will be a lot of work. BTW: All HTTP traffic is on port 80 ( HTTPS is on port 443 ) for both GET and POST requests. The difference is only in the HTTP headers.
It may be easier to write a small website using the same technology as your target site and look at the requests a browser sends to that. You may learn enough to guess what is being sent to your target site for a given event.
Lastly, if the pages are too complex, you''re basically going to have to write a browser user agent. How much effort do you want to put into this?
Here''s a start:
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol[^]
Nick
是的,谢谢尼克.你让我不知所措,我认为那将是答案:(
我试图隐藏"类库中的webby内容,所以不想使用Web浏览器.但是,通过浏览器完成此操作,我将在一个小时左右的时间内完成此操作,而大约需要一周左右的时间通过webrequest完成.
哦,对了,这是我要添加的内容(不断扩展的内容),以供日后使用.浏览器现在必须是.
谢谢
艺术
yeah, thanks Nick. You got my drift and I thought that was going to be the answer :(
I was trying to "hide" the webby stuff in a Class Library, so didn''t want to use the Web browser. However, doing it via browser I will have this done in an hour or so, via webrequest probably a week or so.
Oh well, something to add to my (ever expanding) to do list for later. browser it will have to be for now.
Thanks
Art
这篇关于Webrequest-哪些数据和目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!