[wp-trac] [WordPress Trac] #60658: Set http_build_query as an option to Curl class
WordPress Trac
noreply at wordpress.org
Thu Feb 29 09:46:40 UTC 2024
#60658: Set http_build_query as an option to Curl class
-------------------------+-----------------------------
Reporter: elzix | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version: 6.4.3
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
I had a problem integrating an API, as explained in this
[[https://stackoverflow.com/questions/78075910/reduce-the-parameters-of-
wordpress-curl/78080020|Stack Overflow question]].
I was requesting that an option (e.g. `'query_body' => true` by default)
be added to `$args` in `class WP_Http`. The option would affect `class
Curl` under `function setup_handle` where `$data = http_build_query($data,
'', '&');`
It would then look like (or similar):
class-wp-http.php (line 206):
{{{#!php
'body' => null,
'query_body' => true,
'compress' => false,
}}}
class-wp-http.php (line 322):
{{{#!php
$options = array(
'query_body' => $parsed_args['query_body'],
'timeout' => $parsed_args['timeout'],
}}}
Curl.php (line 393):
{{{#!php
} elseif (!is_string($data)) {
$data = $options['query_body'] ?
http_build_query($data, '', '&') : $data;
}
}}}
When I make these changes to my copy of WordPress, the API works and it
does not affect the rest of the core.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60658>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list