‘wp_remote_post’ is the function you’re searching for.
$response = wp_remote_post( $url, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => array( 'param1' => 'value1' ),
'cookies' => array()
)
);
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
echo "Something went wrong: $error_message";
} else {
echo 'Response:<pre>';
print_r( $response );
echo '</pre>';
}
Related Posts:
- WP REST API only returning partial list of users
- WordPress JSON output
- get WP-API by page id
- utf8 encoding in json rest api
- Implementing the wp json-rest api
- Displaying Content with WP Rest API
- How to Increase WordPress JSON API Speed?
- How can I cache WordPress Rest API Response
- Why aren’t tags and categories added in post request to WP Rest API
- body_class REST field in WP-API
- Submit comment via JSON from Android device
- How to convert and use JSON data from a remote WordPress server?
- JSON API and notification about registration
- Jetpack JSON API configure button not showing [closed]
- WordPress Theme/Plugin Information API Response to Text and Button
- Implementing URL JSON API Data into Website
- Intergrate JSON into wordpress
- How do I filter Child Posts by Parent Post ID for Custom Post types in WordPress REST API response?
- Rest WP_Error always return null
- Daily automatic update of stock quotes via REST API and Cronjob. Or is there a more sophisticated way?
- Why does “if statement” has to “die()”, otherwise wont work?
- Best way to make a JSON API from WordPress?
- Querying Posts Using JSON API
- How get JSON from external API on every page load if not existing in transient?
- Send PUT remote request with BuddyPress checkbox
- This page didn’t load Google Maps correctly. See the JavaScript console for technical details
- This page didn’t load Google Maps correctly. See the JavaScript console for technical details
- Constructing requests with URL Query String in Python
- WordPress Rest API custom endpoint optional param
- Create API for single sign-on with 3rd party site
- Fetch All Posts (Including Those Using a Custom Post Type) With WordPress API
- What is the best way to get directory path for wp-config.php?
- External WordPress API
- How to get featured post title & image using JSON API?
- List Table API – Safe to use?
- API integration with WordPress
- POST to a REST API from a wordpress form
- Custom route for WP-API gives “rest_no_route” value
- “rest_no_route” – Debug error
- How to Securely and remotely Create new user in wordpress using Rest API
- API in numbers?
- Stuck with wp_remote_post sending data to an external api on user registration
- How to get title tag of an external page with http api?
- WordPress REST API “rest_authentication_errors” doesn’t work external queries?
- How do I perform a “get” call to an external API, and then display the JSON results on a page in my WordPress site?
- how to decode % in app [closed]
- WordPress JSON API Extend to Create Users [closed]
- External API to WP
- Can’t get POST data in API endpoint callback
- node-wpapi: how to handle authentication?
- Post body not working with wp_remote_post()
- Adding rest api endpoints to an old theme
- Develop REST API using WordPress for Android app [closed]
- Integrate ZOHO Recruit API?
- woocommerce registration form with klaviyo(don’t work with current user)
- Allow logged in WordPress user to access 3rd party Laravel API via OAuth
- CMB2 Repeatable Group & JSON API
- WordPress REST API not returning all posts
- Sanitize Disqus API results?
- Best Practice for re-using API Data in WordPress?
- For using google api is it necessary to install the google client libraries for using Oauth 2 in wordpress installation?
- Enabling CORS with WordPress
- How do I query my WordPress posts on another HTML page using the WordPress Restful API?
- Authenticating a user with the WP-API V2 in Postman
- WP OAuth Server “The grant type was not specified in the request”
- WordPress keeps autoplaying my Youtube-Links no matter what I write
- Is there a way I can fetch the WordPress Developer Code References with an API?
- Integrating API in to WordPress
- How to get the post_id after you successfully create new post using xmlrpc api wp newPost?
- hybridauth (google OAuth integration) and WP problems
- term_exists returns NULL
- How to queue API requests with PHP in WordPress?
- WP REST API remove the WordPress shortcodes from the JSON wp/v2/posts content->rendered
- WordPress API causing fatal error
- Composer Installed Package with WordPress Rest API Endpoint
- how to create JSON array [] for REST response?
- Is there a way to get Google My Business photos on WordPress with the API or other?
- Call external API
- exclude particular category in api
- How to receive JSON payload from a digital device
- Loop through WordPress API response errors
- How to save one API response to WooCommerce order meta data
- WordPress json rest api displaying 10 categories only
- Populating Custom Fields from live JSON
- Creating posts, containing data from remote API
- Passing data outside of WordPress possible?
- Periodically Query an external API on wordpress site
- Post to WordPress API using cURL and login cookies
- Extending the API I created to return category names
- Posting data from Ionic app to WordPress
- Encrypt API key [duplicate]
- Can I get the post id when trying to make a new post using xmlrpc?
- Using PHP Api wrapper within plugin. Wrapper uses name space
- basic wordpress api endpoint to serve a key-value dictionary
- Is it possible to make website content available on another website?
- How to login via wordpress api and get user details?
- How many users/load can the rest API handle?
- XMLRPC: How to retrieve possible custom fields for a new post?
- Forminator + Hubspot Workflows
- Using WordPress API to mass update posts freezes the server