0
votes

I have installed gnulinux for windows and want to download page with 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 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

My result is like:

curl: (6) Could not resolve host: Mozilla; Host not found curl: (6) Could not resolve host: (X11;; Host not found curl: (6) Could not resolve host: U;; Host not found curl: (6) Could not resolve host: Linux; Host not found curl: (6) Could not resolve host: i686;; Host not found curl: (6) Could not resolve host: en-US;; Host not found curl: (6) Could not resolve host: rv:1.9.1.8); Host not found

Should I place quotes somewhere?

2

2 Answers

1
votes

You need to quote the various parameters passed to -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

Also, you probably don't need most of those. Try just curl -o file3.htm http://www.mygarden.com

1
votes

I would use it this way:

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