博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在linux和Windows使用curl,使用POST提交JSON数据(转)
阅读量:2351 次
发布时间:2019-05-10

本文共 1012 字,大约阅读时间需要 3 分钟。

转:https://blog.csdn.net/kkgbn/article/details/71420214

 

 

在linux

  • &需要用\&转义

GET:

 

curl http://119.29.151.177/account/password/find?channel=2201\&account=abc
 

 

POST:

 

curl -X POST http://demo.wiliamy.com/account/password/find?channel=2201\&account=abc
 

 

 

使用POST提交JSON数据

 

curl -l -H "Content-Type:application/json" -H "Accept:application/json" -X POST -d "{ \"studentId\":661, \"courseIds\":[3,19,27], \"status\":\"STARTED\"}" http://10.0.00.00:8080/search/status

 

在windos power shell

-&需要用双引号括起来

GET:

 

curl  http://demo.com/account/password/find
 

 

POST:

curl  http://demo.com/account/password/find?channel=2201"&"account=abc  -Method post
  • 1

我们可以用get-help 看帮助信息:

get-help Invoke-WebRequest 名称    Invoke-WebRequest语法    Invoke-WebRequest [-Uri] 
[
]别名 iwr wget curl备注 Get-Help 在此计算机上找不到该 cmdlet 的帮助文件。它仅显示部分帮助。 -- 若要下载并安装包含此 cmdlet 的模块的帮助文件,请使用 Update-Help。 -- 若要联机查看此 cmdlet 的帮助主题,请键入: "Get-Help Invoke-WebRequest -Online" 或 转到 http://go.microsoft.com/fwlink/?LinkID=217035。
你可能感兴趣的文章
inline函数必须在头文件中定义吗?
查看>>
内存泄漏检查工具valgrind使用方法
查看>>
Solution of Codility
查看>>
java解析XML的四种方式及比较
查看>>
单例模式(java)详细
查看>>
策略模式(java)
查看>>
java线程中信号量Semaphore类的应用
查看>>
如何设置CentOS为中文显示
查看>>
Nginx配置
查看>>
php-fpm配置
查看>>
Centos 系统时间与当前时间相差和时区解决办法
查看>>
Linux下如何进行FTP设置
查看>>
linux之LVM操作案例
查看>>
由于CentOS的系统安装了epel-release-latest-7.noarch.rpm 导致在使用yum命令时出现Error: xz compression not available问题。
查看>>
php中抽象类和接口的概念与区别
查看>>
php抽象类和接口
查看>>
如何在linux CentOS 上安装chrome 谷歌浏览器
查看>>
laravel5 怎么实现事务
查看>>
GitLab安装说明
查看>>
Git查看、删除、重命名远程分支和tag
查看>>