我有一些url,它的查询参数中有空格。我想用这个做卷发。
curl -G "http://localhost:30001/data?zip=47401&utc_begin=2013-8-1 00:00:00&utc_end=2013-8-2 00:00:00&country_code=USA"它会发出
Malformed Request-Line根据我的理解,o/p是由于查询param中存在的空间造成的。
在将url提供给curl命令之前,是否可以自动对其进行编码?
发布于 2013-08-14 16:40:24
curl支持--data-urlencode内部的url编码:
$ curl -G -v "http://localhost:30001/data" --data-urlencode "msg=hello world" --data-urlencode "msg2=hello world2"-G也是将数据附加到URL中所必需的。
跟踪标头
> GET /data?msg=hello%20world&msg2=hello%20world2 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu)
> Host: localhost
> Accept: */*https://unix.stackexchange.com/questions/86729
复制相似问题