Online curl command line builder
curlbuilder.com
curlbuilder.com
Instead I'd probably recommend people use Chrome/Chromium's developer tools which can export HTTP requests as curl commands: https://coderwall.com/p/-fdgoq/chrome-developer-tools-adds-c...
Disclaimer: I have no connection with Paw's developers - I'm just a very happy user.
- another unpaid but wholly satisfied user
Edit:
Example of this in zsh:
# tiksi@layla ~
$ echo "http://example.com/uid=${thisisgone}-$(date)`pwd`\n\x00\x00nulletc\x0a" [09:38:50]
http://example.com/uid=-Thu Apr 23 09:38:53 EDT 2015/home/tiksi
nulletc
# tiksi@layla ~
$ curl -vv -s "http://example.com/uid=${thisisgone}-$(date)`pwd`\n\x00\x00nulletc\0xb" 2>&1|egrep GET [09:47:26]
> GET /uid=-Thu Apr 23 09:47:41 EDT 2015/home/tiksi\n\x00\x00nulletc\0xb HTTP/1.1Adding single quotes is safer, but will fail if the argument itself contains single quotes.
To my knowledge, the correct shell escaping is to surround your argument with single quotes, and before doing that, replace each contained single quote
'
with the following sequence (1): '\''
Alternatively, you can use (2): '"'"'
Both sequences work the same way: First, terminate the single-quoted string. Then, add an escaped single quote, either with backslash (1) or by encapsulating into double quotes (2). Finally, start an new single-quoted string. tiksi@emperor:~$ curl 'http://\'test'
>
>
>
>^C
tiksi@emperor:~$ curl 'http://\'test''
curl: (6) Could not resolve host: \test
tiksi@emperor:~$
Anything inside single quotes is treated literally, so no escapes work.( Unless you're doing $'.stuffhere', but that's a whole other can of worms). The double quotes around single quotes does work though.That's why you have to escape single quotes with
'\''
rather than just \'
As I said, you first have to terminate the single-quoted string, then add the single quote, then start a new single-quoted string.In your example, my variant (1) leads to:
curl 'http://'\''test'
And my variant (2) leads to: curl 'http://'"'"'test' "$(sed -r 's/([allthespecialchars])/\\\1/g')"
, but '\'' is much cleaner.I have found the terminate and escape quite useful for color codes though
'string'\e[31m'red'"$var"'morestring',
not sure how I never thought to use it for '\'', but thats getting added to my toolbox :) req = require('library').request(url, handler);
console.log(req.toCurl());
Haven't found one yet.This would be useful for things like grabbing a test Stripe webhook sent to requestb.in and sending it to your local dev server.
(I think there are some things you can host yourself to capture and replay HTTP requests, however - I can't remember what they are)
Another favorite of mine is the Tamper extension, which lets you edit js / css and reload the page, having your edited versions served from mitmproxy: https://chrome.google.com/webstore/detail/tamper/mabhojhgigk...
# invoke the curl manual:
man curl
and # display a basic help file:
curl -hThis also makes me want to go back and add Copy as curl to hurl.it.
curl http://example.com -H 'Authentication: root' -H 'Password: p4ssw0rd'Curl provides a shortcut for this as --user; e.g. curl --user name:pass http://example.com
Try it yourself with -vvv to see all the headers from both ends. Ref: http://curl.haxx.se/docs/httpscripting.html#Basic_Authentica...
http basic auth protocol: http://en.m.wikipedia.org/wiki/Basic_access_authentication
Does anybody know how to escape curly braces on tcsh?
I was hoping for some JS library that would generate the commands with proper escaping etc.
Of course this is just a 10 minutes experiment.