why doesn't cURL process range when there's some other data in URL after stated range

89 Views Asked by At

why doesn't cURL process range when there's some other data posted after the range? Example -- I wanna post 400 messages like this:

curl -X POST -d "$post_data" "http://www.example.com/post_id=[1-400]&message[body]=Hello

However, the cUrl doesn't post them - only after I remove the ''&message[body]=Hello' part - curl is able to process request with blank messages. How can I write the command so that curl will process the range with included message also?

Thanks in advance

1

There are 1 best solutions below

0
On

[] has a special meaning at curl. Specially when you are defining a range(i.e. the one you are already using at the command).

Escape [] using \ character. See below:

curl -X POST -d "$post_data" "http://www.example.com/post_id=[1-400]&message\[body\]=Hello
                                                                            ^     ^