到目前为止,我已经尝试过:
Dim wreq As HttpWebRequest = WebRequest.Create("http://www.nasdaq.com/symbol/goog/financials?query=income-statement&data=quarterly")
wreq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5"
wreq.Method = "get"
Dim prox As IWebProxy = wreq.Proxy
prox.Credentials = CredentialCache.DefaultCredentials
Dim document As New HtmlAgilityPack.HtmlDocument
Dim web As New HtmlAgilityPack.HtmlWeb
web.UseCookies = True
web.PreRequest = New HtmlAgilityPack.HtmlWeb.PreRequestHandler(AddressOf onPreReq)
wreq.CookieContainer = cookies
Dim res As HttpWebResponse = wreq.GetResponse()
document.Load(res.GetResponseStream, True)
Debug.WriteLine(document.DocumentNode.OuterHtml)
但它会返回此网址的 HTML:http ://www.nasdaq.com/symbol/goog/financials?query=income-statement
而不是这个:http ://www.nasdaq.com/symbol/goog/financials?query=income-statement&data= Quarterly
我究竟做错了什么?
附加信息
这是onPreReq
Private Function onPreReq(req As HttpWebRequest)
req.CookieContainer = cookies
Return True
End Function