钩子文档

http_api_curl

💡 云策文档标注

概述

http_api_curl 是一个 WordPress 动作钩子,在 cURL 请求执行前触发,允许插件处理 HTTP API 中未处理的 cookies。

关键要点

  • 触发时机:在 cURL 请求执行之前
  • 主要用途:为插件提供处理 cookies 的机制,因为 HTTP API 当前不处理 cookies
  • 参数:$handle(cURL 句柄,引用传递)、$parsed_args(HTTP 请求参数数组)、$url(请求 URL 字符串)
  • 相关函数:通过 do_action_ref_array() 调用,关联 WP_Http_Curl::request() 等方法
  • 版本历史:自 WordPress 2.8.0 引入

📄 原文内容

Fires before the cURL request is executed.

Description

Cookies are not currently handled by the HTTP API. This action allows plugins to handle cookies themselves.

Parameters

$handleresource
The cURL handle returned by curl_init() (passed by reference).
$parsed_argsarray
The HTTP request arguments.
$urlstring
The request URL.

Source

do_action_ref_array( 'http_api_curl', array( &$handle, $parsed_args, $url ) );

Changelog

Version Description
2.8.0 Introduced.