html - 如何使用 Curl 发送参数和值?
问题描述
我正在尝试使用 GET 向网页发送 curl 请求以发送参数及其值。它适用于前两个,但最后一个“a-listibg-pro”由于我假设的连字符而不断给我带来麻烦。请帮忙
curl -X GET <url>?"type"="fruit"&"number"="two hundred and one"&"a-listing-pro"="yes but conditional"
解决方案
连字符是 URL 安全的,所以这不应该是问题。
请注意,空格和其他特殊字符在用于查询字符串之前需要进行 URL 编码。
https://www.w3schools.com/tags/ref_urlencode.ASP
空格通常用%20
or编码+
,因此您的字符串可以用作
curl "https://example.com/?type=fruit&number=two%20hundred%20and%20one&a-listing-pro=yes%20but%20conditional"
(卷曲默认为GET
所以不需要-x
)
推荐阅读
- javascript - 如何在不实际使用样式组件的情况下复制样式组件中的“as”道具?
- angular - 如何根据条件chartjs angular隐藏特定数据集
- c++ - 如何在c++中访问父类的函数并将变量保留在父类中?
- vb.net - Picturebox.click acting different than button.click?
- drupal - 在drupal中以表格或网格格式显示列表
- javascript - webpack 中的 shadowDOM 样式
- python - json.decoder.JSONDecodeError:期望值:从 understat.com 抓取数据时出现第 1 行第 1 列(字符 0)错误
- xcode - 无法使用 brew 安装任何东西
- asp.net-core - AJAX 帖子不发送数据.Net Core
- javascript - 如何修复循环内的异步代码以按顺序运行程序