最簡單的get訪問(-X GET可選):
curl www.test.com
使用用戶名和密碼:
curl -u name:passwd http://www.test.com
查看詳細訪問過程:
curl -v www.test.com
post訪問(因爲-d就指定了post,可以省略-X POST):
curl -d "user=kevinchuang&passwd=123456" http://www.test.com
#curl -X POST -d "user=kevinchuang&passwd=123456" http://www.test.com
post指定數據類型:
curl -H "Content-Type:application/json" -d '{"user": "kevinchuang", "passwd":"123456"}' http:www.test.com