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?
- Can’t save Image from external API into Database
- How do I return XML to an API post request
- Difference Between Filter and Action Hooks?
- 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 create an API for my plugin?
- How to store username and password to API in wordpress option DB?
- Query WP REST API v2 by multiple meta keys
- Is there a limit on making calls to WordPress.org API’s?
- How do I cache (core) API requests?
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- how to use nimble-API and Display data?
- WordPress REST API – get custom taxonomy category posts
- How to display relations via wordpress Rest API
- How to do admin ajax request in a plugin for rest api
- Showing results from json-string in WordPress search results page
- Attaching Image-file to userId
- Get API auth_token token to renew weekly
- Query String Filtering API
- 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
- Get Custom taxonomy parent with wordpress REST API
- register_meta not showing custom post type metabox data in rest api
- register/login 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
- Securing custom rest API endpoints with public access from PWA
- How do i post data to url with fields?
- call funcution when clicking submit
- WP_Query not ordering correctly
- Help to create the best plugin settings!
- 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
- How do I make secure API calls from my WordPress plugin?
- Deleting media using the WordPress Rest API
- Generate Static Page to Show Search Results/Detail for API
- Initializing rest endpoint issue
- 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
- React in plugins: REST endpoints vs. regular functions
- How do WordPress plugins work with oAuth2 APIs?
- How to debug new shortcode? And how to get string from shortcode into code?
- 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?
- Can a plugin differentiate syndication feeds from actual site views?
- 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
- Is it possible to make WordPress as a RESTful app?
- How do I query posts and have their related taxonomies returned in the results?
- modify buddpress adminbar only in admin pages
- multi-language multi-site with REST API
- oneOf two possible objects in WP REST API?
- How can I send api calls from my plugin?
- Extend Plugin that creates an endpoint for GET request to also accepts POST requests
- 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)
- Is it possible to create post in wordpress using postman?
- 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
- REST API error in block editor for custom templates
- How to get locale within WP REST Request?
- Execute callback after REST API request completes + Response is sent
- How to boost WP custom post REST API GET queries by custom taxonomies
- How to submit a button automatically after every scheduled hours?
- i need to resive data external api and show user
- Transmit headers and footers via API from one site to another
- Images stored from external API not loading
- WordPress getting data from external API
- how to send csv file to other server using wp_remote_post?
- Show Image in Plugin Development