CURL
From Indie IT Wiki
A command line tool for transferring data with URLs.
Test Web Site Speed Performance Using Curl
curl -s -w 'Testing Website Response Time for %{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://www.bbc.co.uk Testing Website Response Time for https://www.bbc.co.uk Lookup Time: 0.015612 Connect Time: 0.022144 AppCon Time: 0.082065 Redirect Time: 0.000000 Pre-transfer Time: 0.082170 Start-transfer Time: 0.485600 Total Time: 0.511278
Using Variables
You have to use double double quotes and escape the ones you need!
If you want to end up with an IP address in quotes...
"123.456.78.90"
... it has to be written as
"\""${MYIP}"\""
...so that the shell can expand the variable.
For example, calling the GANDI Live DNS API to update a record for fish.mydomain.com using your public IP address...
export MYIP=$( curl -s ifconfig.me ) && curl -s -X PUT -H "Content-Type: application/json" -d '{"rrset_values":['"\""${MYIP}"\""']}' -H "Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxx" https://api.gandi.net/v5/livedns/domains/mydomain.com/records/fish/A
SNI
Server Name Identification is the method of requesting a partuclar host on a shared server, to make sure you request the correct SSL Certificate.
The curl option 'resolve' allows you to specify which IP address to resolve the domain name to, great for testing an Let's Encrypt SSL Certificate...
curl -vik --resolve domain.org.uk:443:172.17.0.2 https://domain.org.uk
POST
curl -X POST -F 'ip=23.129.64.235' https://www.zerospam.org/wp-json/v1/query
Output To File
curl -O URL
Output Web Page As Plain Text
curl -s https://www.google.co.uk/ | pandoc -f html -t plain
Follow Redirection With Details
curl --insecure --verbose --location URL