Unable to get url using curl

When trying to get the URL http://www.kat.ph/search/snow-patrol-shut-your-eyes/?categories%5B%5D=music using curl I get an error

curl: (3) [globbing] illegal character in range specification in pos 65

Why is this so? while [seems to be a valid character in the address bar of the browser, how can I get the same url in curl?

+4
source share
3 answers

curl http://www.kat.ph/search/snow-patrol-shut-your-eyes/?categories%5B%5D=music

works great for me. Is this really what you are using? Or do you have [in your curl line?

Update

Yes, I get the same error on curl http://www.kat.ph/search/snow-patrol-shut-your-eyes/?categories []=music . Your browser silently encodes [] for you when it makes a request (browsers allow users to be lazy). cURL expects you to be able to code for yourself, so characters such as [], space, etc., must be encoded first. Take a look at this tool for encoding or decoding URLs http://meyerweb.com/eric/tools/dencoder/

+4
source

You can use the -g option to stop the curl from pushing itself. Then it will pass the URL from [] to the server as is.

+7
source

You can escape the characters [and] as follows \[ and \]

+1
source

All Articles