12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- % curl, http
- # GET 请求示例:
- curl <url>
- # POST 请求示例:curl -X POST -d "username=user&password=pass" http://example.com/login
- curl -X POST -d "<key_value>" <url>
- # JSON 请求示例:curl -H "Content-Type: application/json" -d '{"name": "John", "age": 30}' http://example.com/data
- curl -H "Content-Type: application/json" -d '<key_value>' <url>
- # 文件上传示例:
- curl -F "file=@<file_path>" <url>
- # 下载shell并立即执行
- curl -sSL <url> | sh
- # 下载文件
- curl -O <url>
- # send a get http request
- curl <url>
- # send a http request
- curl -X <method> <url>
- # send a http request and write the output to a file
- curl -X <method> <url> -o <filename>
- # send a get http request and follow redirects
- curl -L <url>
- # send a get http request exit with a non-zero status code on failure
- curl --fail <url>
- # send an authenticated http request
- curl -u <username>:<password> -X <method> <url>
- # send a http request with a json body
- curl -X <method> <url> -H 'Content-Type: application/json' -d '<json>'
- # send a http request with a form body
- curl <url> -d <bodykey>=<bodyvalue>
- # send a http request and see the request as well as the response
- curl -v <url>
- # send a http request with a body from a file
- curl -X <method> <url> --data-binary "@<file>"
- # send a http request with a custom header
- curl -X <method> <url> -H "<headername>: <headervalue>"
- $ file: ls
- $ method: echo -e 'GET\nPOST\nPUT\nDELETE\nPATCH'
|