CURL命令行URL参数 [英] CURL Command Line URL Parameters

查看:498
本文介绍了CURL命令行URL参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用CURL发送一个带有url参数的 DELETE 请求。我在做:

I am trying to send a DELETE request with a url parameter using CURL. I am doing:

curl -H application/x-www-form-urlencoded -X DELETE http://localhost:5000/locations` -d 'id=3'

但是,服务器没有看到参数id =我尝试使用一些GUI应用程序,当我通过url作为 http:// localhost:5000 / locations?id = 3 ,它的工作原理。我真的宁愿使用CURL而不是这个GUI应用程序。任何人都可以指出我做错了什么?

However, the server is not seeing the parameter id = 3. I tried using some GUI application and when I pass the url as: http://localhost:5000/locations?id=3, it works. I really would rather use CURL rather than this GUI application. Can anyone please point out what I'm doing wrong?

推荐答案

application / x-www-form-urlencoded为什么?试试看:

"application/x-www-form-urlencoded" header, why? Try it out:

curl -X DELETE 'http://localhost:5000/locations?id=3'

curl -X GET 'http://localhost:5000/locations?id=3'

这篇关于CURL命令行URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆