Contents
How to use curl with a GitHub account?
An introduction to curl using GitHub’s API. Pass user credential to basic auth to access protected resources like a users starred gists, or private info associated with their profile Passing just the username without the colon (:) will cause you to be prompted for your account password. This avoids having your password in your command line history
How to tell curl to read from a file?
You can tell curl to read from a file ( @) to POST data Often when POSTing data you’ll need to add headers for things like auth tokens or setting the content type. You can set a header using -H. If an API doens’t have an SSL cert but is using HTTPS you can tell curl to ignore the security by using –insecure.
Why does curl send an HTTP request and receive an answer?
The technical explanation for this is that curl sends an HTTP request and receives the answer in an HTTP Response. An HTTP request can contain arbitrary data; this is how HTTP is designed.
Are there risks to allowing curl from my…?
Worms like to spread, Trojans like to poke backdoors, botnets like to contact control servers, attackers like to exfiltrate (that is, steal) private data, and all these things have a reasonable chance of using curl. This isn’t because curl is popular among hackers, but because curl is popular among programmers.
How to post data from multiple files in curl?
Curl documentation for -d option If you start the data with the letter @, the rest should be a file name to read the data from, or – if you want curl to read the data from stdin. Multiple files can also be specified. Posting data from a file named ‘foobar’ would thus be done with -d, –data @foobar.
How to get curl to read data from stdin?
The -d@- option tells curl to read the data from STDIN. If you want to type/paste the data without escaping or polluting your bash history then, you can use this Which drops you into cat where you can input the data, directly, e.g. Shift + Insert in your terminal.