equal
deleted
inserted
replaced
13 * HTTP request method uses Curl extension to retrieve the url. |
13 * HTTP request method uses Curl extension to retrieve the url. |
14 * |
14 * |
15 * Requires the Curl extension to be installed. |
15 * Requires the Curl extension to be installed. |
16 * |
16 * |
17 * @since 2.7.0 |
17 * @since 2.7.0 |
|
18 * @deprecated 6.4.0 Use WP_Http |
|
19 * @see WP_Http |
18 */ |
20 */ |
|
21 #[AllowDynamicProperties] |
19 class WP_Http_Curl { |
22 class WP_Http_Curl { |
20 |
23 |
21 /** |
24 /** |
22 * Temporary header storage for during requests. |
25 * Temporary header storage for during requests. |
23 * |
26 * |
75 'httpversion' => '1.0', |
78 'httpversion' => '1.0', |
76 'blocking' => true, |
79 'blocking' => true, |
77 'headers' => array(), |
80 'headers' => array(), |
78 'body' => null, |
81 'body' => null, |
79 'cookies' => array(), |
82 'cookies' => array(), |
|
83 'decompress' => false, |
|
84 'stream' => false, |
|
85 'filename' => null, |
80 ); |
86 ); |
81 |
87 |
82 $parsed_args = wp_parse_args( $args, $defaults ); |
88 $parsed_args = wp_parse_args( $args, $defaults ); |
83 |
89 |
84 if ( isset( $parsed_args['headers']['User-Agent'] ) ) { |
90 if ( isset( $parsed_args['headers']['User-Agent'] ) ) { |
325 } |
331 } |
326 |
332 |
327 /** |
333 /** |
328 * Grabs the headers of the cURL request. |
334 * Grabs the headers of the cURL request. |
329 * |
335 * |
330 * Each header is sent individually to this callback, so we append to the `$header` property |
336 * Each header is sent individually to this callback, and is appended to the `$header` property |
331 * for temporary storage |
337 * for temporary storage. |
332 * |
338 * |
333 * @since 3.2.0 |
339 * @since 3.2.0 |
334 * |
340 * |
335 * @param resource $handle cURL handle. |
341 * @param resource $handle cURL handle. |
336 * @param string $headers cURL request headers. |
342 * @param string $headers cURL request headers. |
342 } |
348 } |
343 |
349 |
344 /** |
350 /** |
345 * Grabs the body of the cURL request. |
351 * Grabs the body of the cURL request. |
346 * |
352 * |
347 * The contents of the document are passed in chunks, so we append to the `$body` |
353 * The contents of the document are passed in chunks, and are appended to the `$body` |
348 * property for temporary storage. Returning a length shorter than the length of |
354 * property for temporary storage. Returning a length shorter than the length of |
349 * `$data` passed in will cause cURL to abort the request with `CURLE_WRITE_ERROR`. |
355 * `$data` passed in will cause cURL to abort the request with `CURLE_WRITE_ERROR`. |
350 * |
356 * |
351 * @since 3.6.0 |
357 * @since 3.6.0 |
352 * |
358 * |
353 * @param resource $handle cURL handle. |
359 * @param resource $handle cURL handle. |
354 * @param string $data cURL request body. |
360 * @param string $data cURL request body. |
355 * @return int Total bytes of data written. |
361 * @return int Total bytes of data written. |
356 */ |
362 */ |
357 private function stream_body( $handle, $data ) { |
363 private function stream_body( $handle, $data ) { |
358 $data_length = strlen( $data ); |
364 $data_length = strlen( $data ); |
359 |
365 |