【问题标题】:How to pass post param value with & included using curl如何使用 curl 传递包含 & 的 post 参数值
【发布时间】:2016-11-14 05:58:24
【问题描述】:

我正在尝试使用 post 参数发出 curl 请求。下面是 curl 请求:

curl -d "name=abcdef&ghi&age=20" <http://f1.com>

name 参数值包含&amp; 字符,它充当分隔符。有什么办法可以在参数值中包含 & ??

【问题讨论】:

  • 尝试在 & 符号周围加上单引号。喜欢curl -d "name=abcdef'&amp;'ghi'&amp;'age=20" &lt;http://f1.com&gt;

标签: php post curl


【解决方案1】:

要在 URL 中使用与符号 (&),它必须具有正确的编码 (%26)。

用 URL 中的 %26 替换 name 参数中的 & 应该没问题。

【讨论】:

    猜你喜欢
    • 2015-12-18
    • 2017-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-21
    • 2017-12-26
    • 2017-10-28
    相关资源
    最近更新 更多