WP_REMOTE_POST Requests are being blocked by API provider [closed]

If the API is expecting a JSON object you should change your args to: $args = array ( ‘sslverify’ => false, ‘data_format’ => ‘body’, ‘headers’ => [ ‘Authorization: Bearer {API_KEY}’, ‘Content-Type: application/json’ ], ‘body’ => json_encode([ ‘region’ => ‘USA’, ‘plan’ => 1, ‘label’ => ‘API Test’, ‘app_id’ => 2 ]), ); Encode your data into … Read more

WordPress wp_remote_post vs wp_remote_request

You should be able to use both wp_remote_request() and wp_remote_post() for a ‘POST’ request, as they are just wrappers for the same WP_Http::request method that supports the methods: ‘GET’, ‘POST’, ‘HEAD’, ‘PUT’, ‘DELETE’, ‘TRACE’, ‘OPTIONS’, ‘PATCH’. and the default one is ‘GET’. The difference is that wp_remote_post() function has the ‘POST’ method explicitly set via … Read more

Is curl required?

For the record, I have uninstalled curl and wordpress was working on seamlessly. So I confirm that curl is not a dependency of wordpress. However, some plugins may require curl.

Facebook OAuth, WP_Http::request() vs wp_remote_request()

To answer my own question, when you use WP_Http, the transport used is selected, in this order, from this array: $request_order = array( ‘curl’, ‘streams’, ‘fsockopen’ ); If your PHP supports curl, WP_Http_Curl is used. Curl doesn’t support adding the body array parameters when the method is GET WP_Http_Streams and WP_Http_Fsockopen on the other hand, … Read more