【问题标题】:Prevent Wordpress from adding headers to outgoing requests阻止 Wordpress 向传出请求添加标头
【发布时间】:2016-08-11 07:57:13
【问题描述】:

我正在制作一个向某些第三方 API 发出 HTTP 请求的 Wordpress 插件。在 Wordpress 之外,这可以正常工作,但是在我的 Wordpress 服务器上使用它时,它似乎添加了许多标头,因此我现在有重复的标头,并且请求失败。

谁能帮我防止 Wordpress 添加重复的 Content-Type 和 Content-Length 标头?

Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Content-Length: 20
Content-Length: 20
Content-Type: application/x-www-form-urlencoded

【问题讨论】:

    标签: php wordpress http-headers


    【解决方案1】:

    我通过在进行调用的脚本中进行硬过滤来解决此问题,确保所有标头仅在 CURL 标头数组中出现一次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-22
      • 2012-01-30
      • 2016-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-28
      相关资源
      最近更新 更多