Error timed out with succesfull wp_remote_post

What I’m trying to do: Passing POST data by using wp_remote_post. foreach ( $articles as $article_id ) { $postarray = array( ‘method’ => ‘POST’, ‘timeout’ => 5, ‘redirection’ => 5, ‘httpversion’ => ‘1.0’, ‘blocking’ => true, ‘headers’ => array(), ‘body’ => array( ‘article_id’ => $article_id ), ‘cookies’ => array() ); $response = wp_remote_post($url, $postarray); if … Read more

How to run multiple Async HTTP requests in WordPress?

In my plugin, I want to call 10 or more HTTP requests asynchronously in WordPress so that I need not wait for the response of anyone. Is there any way in WordPress that supports this and also compatible with different WordPress versions? 1 1 The (built-in) Requests class lets you call multiple requests simultaneously: Requests::request_multiple. … Read more

Hook into WordPress update?

I’d like to know if there’s any way to hook into WordPress update process and send $_POST variable to update server? I’m delivering plugin/theme updates from private server and I hook into this: add_filter(‘pre_set_site_transient_update_themes’, ‘check_for_update’); which works just fine. Newer version of theme/plugin appears under Dashboard > Updates and I can update. But the problem … Read more

How to use WordPress HTTP API to download file from remote location

So this PHP code works for me: $ch = curl_init( TCS_CPDF_REMOTE_ZIP ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $data = curl_exec( $ch ); curl_close( $ch ); file_put_contents( TCS_CPDF_LOCAL_ZIP, $data ); but when trying to use the WordPress HTTP API: $the_body = wp_remote_retrieve_body( wp_remote_get( TCS_CPDF_REMOTE_ZIP ) ); file_put_contents( TCS_CPDF_LOCAL_ZIP, $the_body ); I end up getting a 0KB … Read more

How to remove rest api link: in http headers?

i would like to remove the “link:” line added to the http headers since wordpress 4.4 here is a curl -I killcandida.org here is the output extract of the line that i would like to delete: Link: <http://killcandida.org/wp-json/>; rel=”https://api.w.org/” Note that i don’t talk here about html headers but http headers. 1 1 The output … Read more

How to control accept encoding on HTTP API requests?

Related to this ticket about issues with inflating data. So far it had been suggested by API’s support to request gzip instead of deflate. However I cannot find a way to override WP settings that set deflate with highest priority as accepted encoding for all requests. Related functions – WP_Http_Encoding::is_available() and WP_Http_Encoding::accept_encoding(). Is there any … Read more