如何使用Curl发送参数和值?

How to use Curl to send parameters and values?

我正在尝试使用 GET 向网页发送 curl 请求以发送参数及其值。它适用于前两个,但最后一个“a-listibg-pro”因为我假设的连字符而一直给我带来麻烦。请帮忙

 curl -X GET <url>?"type"="fruit"&"number"="two hundred and one"&"a-listing-pro"="yes but conditional"

Hypens URL 安全,所以这应该不是问题。

请注意,空格和其他特殊字符在用于查询字符串之前需要进行 URL 编码。

https://www.w3schools.com/tags/ref_urlencode.ASP

空格通常用%20+编码,所以你的字符串可以用作

curl "https://example.com/?type=fruit&number=two%20hundred%20and%20one&a-listing-pro=yes%20but%20conditional"

(curl 默认为 GET 所以不需要 -x