0
My question is very simple : is it possible to send a HTTP request from the *nix command line specifying a file, containing all the parameters, as an argument?
In REST APIs documentation, we often see that kind of specification
POST /oauth/token HTTP/1.1
Host: api.example.com
Content-Type: application/x-www-form-urlencoded
grant_type=password
&client_id=<API_KEY>
&client_secret=<API_SECRET>
&username=<USER_USERNAME>
&password=<USER_PASSWORD>
To avoid command lines that are very long and uneasy to edit, is it possible to put these informations in a file, in the above-mentioned format (which seems pretty standard) ? Ideally something with curl that would look like
curl --input-file myparameters.txt
I could not find such feature in curl documentation. Maybe with another command line tool? Thanks in advance.
have you tried input redirection?
curl << paramfile
– Frank Thomas – 2015-03-24T11:52:32.377Thanks for your reply. I've tried it and it seems curl doesn't recognize that kind of file as a direct input – benoit – 2015-03-24T12:03:27.250
How about if you write the line
GET /
in a file a.a and docat a.a | nc 74.125.138.106 80
That does work. Then maybe you can add headers to the file a.a ? – barlop – 2015-03-24T16:47:38.887