By default, you use curl without explicitly specifying which request method to use. If you just pass an HTTP url like curl http://example.com , it will use GET. If you use -d or -F , curl will use POST, -I will cause HEAD and -T do this PUT.
If for some reason you are not happy with these default options that curl for you, you can override these query methods by specifying -X [WHATEVER] . Thus, you can, for example, send DELETE by executing curl -X DELETE [URL] .
Thus, it makes no sense to do curl -XGET [URL] , since GET will be used anyway. In the same vein, it curl -X POST -d data [URL]... no sense to do curl -X POST -d data [URL]... But you can make a funny and somewhat rare request that sends the request body to a GET request with something like curl -X GET -d data [URL] .
Digging deeper
curl -GET (using a single dash) is simply wrong for this purpose. This is equivalent to specifying -G , -E and -T , and it will do something completely different.
There is also a waving option called --get so as not to confuse issues with them. This is the long form of -G, which is used to convert the data specified in -d to a GET request instead of POST.
(Subsequently, I used my own answer to fill in the wrap FAQ .
Warnings in 7.45.0 and later
In modern versions of curl, it will inform users of this unnecessary use of -X when the detail mode ( -v ) is on - so that users know. Further explanation and motivation in this blog post .
Daniel Stenberg Dec 14 '11 at 9:20 2011-12-14 09:20
source share