问题描述
我正在尝试使用wget下载登录页面后面的文件。已经有一个answer by @jarnoan。但是,它似乎对我不起作用。我在代理(192.168.100.250)的后面。我还从不位于代理后面的另一台机器上进行了测试,结果是相同的。
这就是我在做什么:
wget --save-cookies cookies.txt --keep-session-cookies --post-data 'user=myuser&password=mypassword' --delete-after https://example.com/Account/LogOn
wget --load-cookies cookies.txt https://example.com/Report/DownloadDataFile?filename=MyData.zip
这是我运行命令时得到的:
$ wget --save-cookies cookies.txt --keep-session-cookies --post-data 'user=myuser&password=mypassword' --delete-after https://example.com/Account/LogOn
--2020-08-11 17:23:45-- https://example.com/Account/LogOn
Connecting to 192.168.100.250:8080... connected.
Proxy request sent,awaiting response... 302 Found
Location: /Account/LogOn [following]
--2020-08-11 17:23:45-- https://example.com/Account/LogOn
Reusing existing connection to example.com:443.
Proxy request sent,awaiting response... 200 OK
Length: 7148 (7.0K) [text/html]
Saving to: ‘LogOn.tmp’
LogOn.tmp 100%[=============================================================================================================>] 6.98K --.-KB/s in 0s
2020-08-11 17:23:45 (20.1 MB/s) - ‘LogOn.tmp’ saved [7148/7148]
Removing LogOn.tmp.
$ wget --load-cookies cookies.txt https://example.com/Report/DownloadDataFile?filename=MyData.zip
--2020-08-11 17:23:51-- https://example.com/Report/DownloadDataFile?filename=MyData.zip
Connecting to 192.168.100.250:8080... connected.
Proxy request sent,awaiting response... 302 Found
Location: /Account/LogOn [following]
--2020-08-11 17:23:51-- https://example.com/Account/LogOn
Reusing existing connection to example.com:443.
Proxy request sent,awaiting response... 200 OK
Length: 7148 (7.0K) [text/html]
Saving to: ‘DownloadDataFile@filename=MyData.zip’
DownloadDataFile@filename=MyData.zip 100%[=============================================================================================================>] 6.98K --.-KB/s in 0.001s
2020-08-11 17:23:51 (13.1 MB/s) - ‘DownloadDataFile@filename=MyData.zip’ saved [7148/7148]
它下载了一个名为DownloadDataFile@filename=MyData.zip
的文件,但是它又只是html登录页面(如Length: 7148 (7.0K) [text/html]
中所示)。
在我看来,第二个命令中实际上并未使用cookie。
任何建议都将受到欢迎。
谢谢!
威尔玛
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)