如何查看封包,以及如何填写WebBrowser1.Navigatec参数POST提交
object.Navigate( _
url As String, _ '这个URL是填写当前IE浏览器地址栏里面的?
[Flags As Variant,] _
[TargetFrameName As Variant,] _
[PostData As Variant,] _
[Headers As Variant])
-------------URL---------------
http://sn128w.snt128.mail.live.com/mail/InboxLight.aspx?n=38940987 -----------这是抓包得到的
http://sn128w.snt128.mail.live.com/default.aspx?rru=inbox ------------这是浏览器地址栏的
http://sn128w.snt128.mail.live.com/default.aspx ------------我看范例里面URL的最后都是ASP
Flags ------------- 好像不用填
TargetFrameName------也是大都不用填,好像
------------PostData --------这个最难填,
参数 值
cnMicrosoft.Msn.Hotmail.Ui.Fpp.MailBox
dtrue,false,true,{"00000000-0000-0000-0000-000000000005",0,0,Date,false,null,null,1,1,false,null,-1,- 1,Off},false,null
mnGetInboxData
mt01_9392c94cabc7114493755ba80540bd09510850c6d51da16ffe6e9ef92f0fa00d|e1f56e55747f5292
v1
上面是使用HttpWatch抓出来的,录制的是点击垃圾邮件,然后就停止录制
00000000-0000-0000-0000-000000000005应该就是垃圾邮件的ID(综合网页源代码判断)
我是否应该发送5次POST那?
还是有什么方法可以一边调试,一边调整参数(现在主要他没出错的提示,也不知道那里错了)我都尝试了很多次,越试越晕。
-------------Headrs------------
Content-Type application/x-www-form-urlencoded
填这个应该差不多,百度的时候好像有人说过中间需要加空格
-----------------------------------下面是网上找的POST提交表单的源代码---------------------------
Private Sub Button1_Click()
Dim URL As String
Dim Flags As Long
Dim TargetFrame As String
Dim PostData() As Byte
Dim Headers As String
URL = "http://sn128w.snt128.mail.live.com/default.aspx?rru=inbox" ' A URL that will accept a POST
Flags = 0
TargetFrame = ""
PostData = "true,false,true,{" & "00000000-0000-0000-0000-000000000005" & ",0,0,Date,false,null,null,1,1,false,null,-1,-1,Off},false,null"
' VB creates a Unicode string by default so we need to
' convert it back to Single byte character set.
PostData = StrConv(PostData, vbFromUnicode)
Headers = "Content-Type: application/x-www-form-urlencoded" & _
vbCrLf
WebBrowser1.Navigate URL, Flags, TargetFrame, PostData, Headers
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://login.live.com/"
End Sub
有那位好心能帮我看看,内容太多了,不好意思,嫌麻烦就挑一两个问题回答也行,我现在分又不多,请多包涵亚。
啃了两天代码了没有搞明白。拜托了。CSDN高手们。
[解决办法]
'网页的部分源代码TargetFrame参数填"aspnetForm"'?
好像不对吧,我只知道HTML标准中有个Target属性:
TARGET Attribute | target Property
--------------------------------------------
Sets or retrieves the window or frame at which to target the contents.
Syntax
HTML <ELEMENT TARGET = sTarget... >
Scripting object.target [ = sTarget ]
Possible Values
sTarget String that specifies or receives one of the following values:name The name of the target window or frame.
_blank Load the linked document into a new blank window. This window is not named.
_parent Load the linked document into the immediate parent of the document the link is in.
_search Load the linked document into the browser search pane. Available in Microsoft® Internet Explorer 5 or later.
_self Default. Load the linked document into the same window the link was clicked in (the active window).
_top Load the linked document into the topmost window.
The property is read/write. The property has a default value of _self.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.
Remarks
If there is no existing window or frame with the same name as specified in the target, a new window is opened with a name equal to the value of the target.
The window name is an optional argument in the open scripting method.
Example
This example uses the TARGET attribute to specify a link that loads the page into the topmost frame of the current frameset.
<A HREF="newpage.htm" TARGET="_top">Go to New Page.</A>