---
title: "curl常用命令"
author: "fairy_xzc"
date: "2018-01-05T13:36:40Z"
tags: []
categories: ["编程语言"]
slug: "curl"
draft: false
lastmod: "2018-01-05T13:37:56Z"
id: 2406755
url: "https://agilestyle.iteye.com/blog/2406755"
---

**原创转载请注明出处：[http://agilestyle.iteye.com/blog/2406755](/blog/2406755)**

 

GET

curl protocol://address:port/url?args

curl http://127.0.0.1:8080/login?username=hello&password=world

 

POST

curl -d "args" protocol://address:port/url

curl -d "username=hello&password=world" http://127.0.0.1:8080/login

 

POST with json body

curl -H "Content-Type: application/json" -X POST --data (json.data) protocol://address:port/url

curl -H "Content-Type: application/json" -X POST --data '{"username": "whoami"}' http://127.0.0.1:8080/login