Useful cURL commands

Working with ADC appliances and with web apps for sure you will need to do some testing. cURL is a nice tool you have on linux systems and now on windows using Windows 10’s Bash Shell via the Windows Subsystem for Linux . Here are some examples i am using:

#cURL with a cookie:
curl -k -vvv --cookie "cookiename=3877714166383783595765382943414841579894" 

#cURL with a useragent:
curl -k -A "myuseragnet/1.1" 

#cURL with a different method than GET (in this case OPTIONS):
curl -k -X OPTIONS  

#cURL with a http header  X-Forwarded-Host  :
curl -k -vvv --header "X-Forwarded-Host:"   

#cURL  POST request: 
curl -k -X POST -d @filename.txt --header "Content-Type:application/json" 

#Using cURL  for security testing:
curl -vvv "" --path-as-is

#Testing response times with cURL
curl -k  -o /dev/null -s -w 'Connect: %{time_connect}\nStart Transfer: %{time_starttransfer}\nTotal: %{time_total}\n'

#Netscaler API calls with cURL 
curl -X GET -H "Content-Type:application/json" -H "X-NITRO-USER: nsroot" -H "X-NITRO-PASS: pass" ""

About the author

Mihai is a Network Aficionado with more than 10 years experience