[wp-trac] [WordPress Trac] #33055: Support Parallel HTTP Requests in WP_Http, et al

WordPress Trac noreply at wordpress.org
Wed Jun 8 01:10:57 UTC 2016


#33055: Support Parallel HTTP Requests in WP_Http, et al
----------------------------------------+--------------------------
 Reporter:  wonderboymusic              |       Owner:  rmccue
     Type:  task (blessed)              |      Status:  assigned
 Priority:  high                        |   Milestone:  4.6
Component:  HTTP API                    |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch needs-dev-note  |     Focuses:  performance
----------------------------------------+--------------------------

Comment (by dd32):

 Replying to [comment:51 mnelson4]:
 > This just broke our plugin's paypal integration because we had an
 `array_key_exists( 'body', $response)` check (which just needs to be
 changed to `isset( $response[ 'body' ] )`).

 For anyone else who runs into this, please don't continue with an
 is_array/ArrayAccess check, which is the wrong thing to do.
 Instead, do something like the following:
 {{{
 $request = wp_remote_get(..);
 if ( ! is_wp_error( $request ) ) {
    ... Request succeeded, perform operations
 }
 OR:
 if ( $headers = wp_remote_retrieve_headers() ) {
   $body = wp_remote_retrieve_body()
   ... act upon $headers/$body
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33055#comment:52>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list