到目前为止我已经尝试过了:
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
答案 0 :(得分:0)
问题在于我的变量Ticker
。它包含我用来创建Web地址的股票代码。到目前为止,我一直在使用所有上限(例如GOOG)。我把所有的代码改为小写(例如goog),这似乎已经成功了。