I have this curl command:
curl -k -d . -o SessionRequest.txt "https://myserver.com/MyWebApi/user?companysn=1234&login=my_login&password=my_password&ApiKey=my_api_key"
What does -d .
stand for? What does it do?
Sending data to the server-d or --data parameter allows to specify data to send to the HTTP server. It simulates a form submission. Invoking cURL with this parameter will make a POST request (instead of default GET ). cURL will set Content-Type as application/x-www-form-urlencoded automatically.
curl (short for "Client URL") is a command line tool that enables data transfer over various network protocols. It communicates with a web or application server by specifying a relevant URL and the data that need to be sent or received. curl is powered by libcurl, a portable client-side URL transfer library.
curl is a command-line tool to transfer data to or from a server, using any of the supported protocols (HTTP, FTP, IMAP, POP3, SCP, SFTP, SMTP, TFTP, TELNET, LDAP, or FILE). curl is powered by Libcurl. This tool is preferred for automation since it is designed to work without user interaction.
To make an OPTIONS request with Curl, you must pass the -X OPTIONS command-line parameter to the Curl request. Browsers send OPTIONS requests when making a CORS request to another origin. The OPTIONS request does not return any data. All information is returned in the response headers.
Whenever your have a doubt use man
.
Issue man curl
and read about -d
switch.
-d, --data <data> (HTTP) Sends the specified data in a POST request to the HTTP cause curl to pass the data to the server using the content-type -d, --data is the same as --data-ascii. --data-raw is almost the ter. To post data purely binary, you should instead use the [...]
It allows you to send ASCII data, eg.:
curl -d '{"hello": "world"}' -X POST -H "Content-Type: application/json" https://example.com
Send a JSON string to the server.
In your example, it just send a .
character as ASCII data to the server. What it does depends on the server logic and is out of the curl
command scope.
This said, we can guess what a .
(dot, period, full stop) might mean in computer science:
Nota: It is considered as a bad practice to send credentials using GET
parameters, avoid it if you can and read more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With