我正在尝试将我的股票投资组合读入脚本。以下适用于 NAB Online Trading 但不适用于Bell Direct。
- 安装导出域 Cookies Firefox 插件
- 使用 Firefox 登录我的在线经纪人
- 将域 cookie 保存到文件(例如
cookies.txt
) wget --no-check-certificate --load-cookies=cookies.txt -O folio.htm https://...
(作品集网址)
-- 这个想法是重用浏览器的登录会话。当我尝试使用 Bell Direct 时,它wget
被重定向到登录页面。我得到相同的结果curl
。我错过了什么?除了 cookie 之外,浏览器中是否还存储了一些状态?Bell 没有使用“基本身份验证”,因为登录页面是用户名/密码的表单——它不会弹出浏览器的内置登录对话框。
这是发生的事情(在带有 Cygwin 的 Windows XP 下):
$ wget --server-response --no-check-certificate --load-cookies=cookies-bell.txt -O folio-bell.htm https://www.belldirect.com.au/trade/portfoliomanager/
--2009-12-14 10:52:08-- https://www.belldirect.com.au/trade/portfoliomanager/
Resolving www.belldirect.com.au... 202.164.26.80
Connecting to www.belldirect.com.au|202.164.26.80|:443... connected.
WARNING: cannot verify www.belldirect.com.au's certificate, issued by '/C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Server CA/emailAddress=server-certs@thawte.com':
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response...
HTTP/1.1 302 Found
Connection: keep-alive
Date: Sun, 13 Dec 2009 23:52:16 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: /account/login.html?redirect=https://www.belldirect.com.au/trade/portfoliomanager/index.html
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 229
Location: /account/login.html?redirect=https://www.belldirect.com.au/trade/portfoliomanager/index.html [following]
...