0

到目前为止,我已经尝试过:

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
4

1 回答 1

0

问题出在我的变量Ticker上。它包含我用来创建网址的股票代码。到目前为止,我一直在使用所有大写字母(例如 GOOG)。我已将所有代码更改为小写(例如 goog),这似乎成功了。

于 2013-11-08T15:33:31.127 回答