Wordpress wp_remote_post vs wp_remote_request

I'm somehow new to Wordpress and its API and while writing an simple Rest Service to an remote Server i have been asked to use the native wp_remote_X functions. Right now i have some trouble to distinguish between them both:

wp_remote_post() 

wp_remote_request().

Does it make any difference which one to use or is the wp_remote_request an alias to missing wp_remote_delete() and wp_remote_update() ?

Topic wp-remote-post wp-remote-request Wordpress

Category Web


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 WP_Http::post that's also a wrapper for WP_Http::request.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.