Your curl request should work from the command line. Put you will want to use make it in a PHP file:
$ch = curl_init();
$url = "https://api.com/";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
http_build_query(array('postvar1' => 'value1')));
// Receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$api_output = curl_exec($ch);
curl_close($ch);
Which php file you put the curl in is going to be dependent on what you are trying to accomplish. For instance, you might setup a cron job to query the api once and hour, updating your content as necessary. Knowing what you are doing would allow me to provide more guidance.
Related Posts:
- Adding custom end points, No error line
- Allow REST API Endpoint to specific user and hide from public
- Adding Amchart Interface to WordPress API
- WP API users per page
- How to update WordPress Plugins in your own maintance application?
- WP REST API only returning partial list of users
- WP REST API V2 – Add user data to response
- Amending REST API function without deactivate/activate plugin every time changes is made
- rest_no_route on custom API endpoint wordpress
- How to create WordPress custom end point with multiple parameters?
- update_callback is not working in register_rest_field
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- How to query a nested field in wordpress api using _fields param
- 403 error rest_’cookie_invalid_nonce’ on API Request
- Extending the API I created to return category names
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- Multisite and the JSON REST API: How to?
- Do you see any problems (mainly security-related) with how I’ve used wp_ajax_* actions?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- How to store username and password to API in wordpress option DB?
- Is there a limit on making calls to WordPress.org API’s?
- Slow REST API calls on self-hosted WordPress [closed]
- Retrieving pages with multiple tags using REST API
- How to check WordPress website username and password is correct
- How do I use the WP REST API plugin and the OAuth Server plugin to allow for registration and login?
- WordPress REST API call generates nonce twice on every call
- permalinks with get variables
- Get more than 10 posts in a specific category with the wordpress api
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Rest Api How to get results of child categories with one api call
- Build dynamic page from cURL (HTML page) response with plugin
- wp_enqueue_style built in styles
- wordpress custom endpoint multiple params
- REST-API: extend media-endpoint
- WordPress REST API “rest_authentication_errors” doesn’t work external queries?
- Should I ask my Twitter plugin users to create their own Twitter App and API Keys to use my plugin?
- Does WordPress’s HTTP API use any caching?
- node-wpapi: how to handle authentication?
- Get all tags not just first 10 with wp api 2.0
- How to add WP API and JS featured image attachment
- Why aren’t tags and categories added in post request to WP Rest API
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- Create a new post using rest api and save featured image using an external image url
- Why does wp_remote_post returns an empty body response on certain endpoints?
- How to modify WCMP Rest API response?
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- woocommerce_checkout_order_processed hook executing function twice
- How to do POST request with WP REST API v2 to custom table?
- What to hook into to check a value before a post is published?
- Custom Rest Endpoint: Post/Put/Patch not working
- Encoding Method for URLs?
- WordPress Rest API with rest_do_request, possible race condition?
- Creating a WordPress Post via REST API – HTML or Markdown?
- REST Endpoint API 404
- WP REST API and Access-Control-Allow-Origin
- Best way to retrieve data in custom api extended from wp-api
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- WordPress REST API – get custom taxonomy category posts
- Showing results from json-string in WordPress search results page
- Attaching Image-file to userId
- Get API auth_token token to renew weekly
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- GET request return value as error instead of success
- Escape commas in REST API
- register_meta not showing custom post type metabox data in rest api
- WordPress REST API in Integromat: How to overcome “Sorry, you are not allowed to list users / edit this…”
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Remove unwanted fields from WP API response
- WordPress API “code”:”rest_no_route” with Custom Route
- is it possible to fetch data from a remote api while admin is writing a new post?
- WC REST API Error Handling
- Deleting media using the WordPress Rest API
- Generate Static Page to Show Search Results/Detail for API
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- .htaccess and proxy settings for routing a decoupled REST API consuming theme
- add pagination to wp_remote_get
- How do WordPress plugins work with oAuth2 APIs?
- Query only title/field/featured media of posts [closed]
- API WordPress is Limited? Return False
- WP-API + JS Backbone client – how to update post meta
- Tie specific functions to options-update for limiting API requests
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Best place to keep files that are called by cron jobs?
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- Is it safe to use PUT and DELETE requests
- add_rewrite_rule not working
- How do I query posts and have their related taxonomies returned in the results?
- multi-language multi-site with REST API
- oneOf two possible objects in WP REST API?
- How can I create a custom plugin to call webapi after user registration?
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Rest Api WordPress
- Programmatically creating posts based on external JSON feed (asynchronously)
- Does WP REST API cache internally executed (rest_do_request) requests?
- Run different permission_callback depending on HTTP method of custom REST API endpoint
- Adding Microsoft Teams Incoming Webhook to WordPress, Problem with Rest Route?
- Woocommerce API for calling products by Category ID
- How to get locale within WP REST Request?
- How to boost WP custom post REST API GET queries by custom taxonomies
- How to submit a button automatically after every scheduled hours?