怎么下载页面卷曲?在Windows / cmd中

时间:2013-08-08 11:49:58

标签: curl

我已经为windows安装了gnulinux,并希望下载curl页面

curl -o file3.htm -H User-Agent:Mozilla / 5.0(X11; U; Linux i686; en-US; rv:1.9.1.8)Gecko / 20100214 Ubuntu / 9.10(karmic)Firefox / 3.5.8 -H接受:text / html,application / xhtml + xml,application / xml; q = 0.9, / ; q = 0.8 -H Accept-Language:en-us,en; q = 0.5 - H Accept-Charset:ISO-8859-1,utf-8; q = 0.7,*; q = 0.7 -H Keep-Alive:300 -H Connection:keep-alive http://www.mygarden.com

我的结果如下:

curl:(6)无法解析主持人:Mozilla;主机未找到 curl:(6)无法解析主机:(X11 ;;未找到主机 卷曲:(6)无法解析主持人:U ;;主机未找到 curl:(6)无法解析主机:Linux;主机未找到 卷曲:(6)无法解析主机:i686 ;;主机未找到 卷曲:(6)无法解析主持人:en-US ;;主机未找到 卷曲:(6)无法解析主持人:rv:1.9.1.8);主机未找到

我应该在某处放置引号吗?

2 个答案:

答案 0 :(得分:1)

您需要引用传递给-H

的各种参数
curl -o file3.htm -H "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8" -H "Accept-Language: en-us,en;q=0.5" -H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" -H "Keep-Alive: 300" -H "Connection: keep-alive" http://www.mygarden.com

此外,您可能不需要大部分内容。试试curl -o file3.htm http://www.mygarden.com

答案 1 :(得分:1)

我会这样用它:

curl -o file3.htm 
    -H "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8"    
    -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8" 
    -H "Accept-Language: en-us,en;q=0.5"
    -H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" 
    -H "Keep-Alive: 300" 
    -H "Connection: keep-alive" http://www.mygarden.com