Differences
This shows you the differences between two versions of the page.
curl [2017/10/12 13:21] |
curl [2021/04/05 11:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== cURL ====== | ||
+ | cURL is a program for making HTTP request, f. e. accessing a web site or calling a web service. | ||
+ | |||
+ | ===== Basic Auth ===== | ||
+ | In Basic Auth the username and password Base64 encoded and added to the HTTP headers. cURL can do this easily with an option. | ||
+ | |||
+ | curl --user my_user: | ||
+ | | ||
+ | ===== Response Format ===== | ||
+ | When using web services one can add a request for a specific format for the response using HTTP headers. | ||
+ | |||
+ | curl http:// | ||
+ | |||
+ | ===== Passing Form Parameter ===== | ||
+ | |||
+ | curl -d " | ||
+ | |||
+ | ===== Passing Query Parameter ===== | ||
+ | Query parameter are passed in the url by adding key/value pairs after the ? sign in the url. Example: | ||
+ | |||
+ | curl http:// | ||
+ | |||
+ | If this url is used with curl than the parameters //start// and //rows// are being dropped and the curl process is executed in the background. Why? Because the first & tells the shell to execute the command in the background. The shell won't recognize it as part of the url. | ||
+ | |||
+ | Solution: Use double quotes. | ||
+ | |||
+ | curl " | ||
+ | |||
+ | ===== Passing Data from File ===== | ||
+ | Instead of passing the post data from the command line it can also be read from a file: | ||
+ | |||
+ | curl http:// | ||