我可以通过 url 下载文件,但是当我从 bash 尝试时,我得到的是 html 页面而不是文件。
如何使用curl、wget 或其他方式下载带有url 重定向(301 永久移动)的文件?
UPD
来自 url 请求的标头。
curl -I http://www.somesite.com/data/file/file.rar http://www.somesite.com/data/file/file.rar
HTTP/1.1 301 Moved Permanently
Date: Sat, 07 Dec 2013 10:15:28 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3
Location: http://www.somesite.com/files/html/archive.html
Vary: Accept-Encoding
Content-Type: text/html
X-Pad: avoid browser bug
Use -L, --location
遵循重定向:
$ curl -L http://httpbin.org/redirect/1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)