I think I’ve figured out the solution.
The short answer is GET requests don’t usually have a body, but wp_remote_get() will take what one assigns to the body argument and make it into URL parameters. That’s why it expects an array (because each element of the array becomes a parameter added to the URL).
One solution is to simply wrap the “body” in an “array()”, like this:
"body" => array($body),
and then retrieve the body on the receiving end as the first request parameter.
Related Posts:
- How to build an API as a plugin
- Create or Update thousands of woocommerce products via PHP
- How to access data in wordpress database externally using php
- wp_remote_get() returns 403 while file_get_contents() does not
- Integrating boxtal PHP library into a custom WordPress Plugin
- Api external with wordpress
- How to convert Currency from USD to other IP Based currency in Php function
- How do I display PHP file contents on front end of WordPress?
- Push Contact form 7 variable to front end after submission
- cURL External API request displays content above other content on page
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- Disable email notification after change of password
- Get a list of all WordPress.org Plugins?
- __(): What if I have to pass in a variable?
- Run WP-CLI using PHP
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Plugin update error message
- How can I make my custom shortcode work in a Custom HTML Widget?
- PHP Deprecated: Non-static method should not be called statically
- Set a User as Author of all ‘New Posts’ posted
- Which hook callback has priority if both plugin and theme use the same hook?
- Calling function from within functions.php returns unwanted value
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Check if a class exists within a method
- Get Plugin Information from Multiple Sites Externally
- Escape special characters in image link
- force customers to add only single item to card per purchase EDD [closed]
- How to get post URL in the_content filter?
- Write to / remove from default .htaccess file from plugin?
- Best way to hook a custom url?
- Auto delete WordPress users according to time
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- Why isn’t admin_notices displaying my text? [Simple Plugin, Beginner]
- Programatically download a plugin
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- How to Use Parameters with a Do_Action Function Within PHP Tags
- Theme my Login plugin, how to update fields
- CSS from textarea in options page to frontend what to do
- How do I pass a post ID to the page URL?
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- add image crop function like in wp customizer
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Bootstrap and Custom CSS in custom plugin are being overwritten by theme
- Self-serve ad system like Reddit’s for WordPress? [closed]
- Create a plugin from within WordPress
- Class variables not correct on page
- Load Javascript from Plugin in One Page Only?
- Call plugin with php function
- Prevent plugin from intruding on wp-json posts api
- What happens when WordPress memory limit is exceeded?
- wp_dequeue_script for a Plugin
- How do I add $_SESSION[”] to my wordpress page?
- output html on post or page from custom plugin [closed]
- WordPress: Add custom add_filter for custom functions
- How can i add simple code in only in posts by function.php
- Hide DIV if empty – Plugin Gallery
- Profile / benchmark wordpress on apache?
- How to change layout of shop page in wordpress? [closed]
- Can i use init hook for API purpose?
- Retrieve Plugin Settings and insert into XML string
- WordPress Stats Plugin: Display Post Views [closed]
- Pagination not working
- exec-PHP shows output at bottom of page
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Can I disable xml-rpc by setting it to false?
- Getting current user data with MySQL statement
- how to validate input field in wordpress generated with wpform plugin
- Add a parameter at the end of the url and prettify
- Calling PHP function with AJAX
- Share my WordPress plugin for updating how?
- How can I change page content for good once a button is pressed?
- Google Maps for Woocommerce Checkout
- working code, not working – Plugin Dev
- One time call to external API in widget
- Add two row of code to the public static function init of a plugin
- Get and Update Most Meta Value as an array in HTML form
- Custom shortcode being shown in WPBakery backend rather than the block
- Failed to load resource: the server responded with a status of 500 () post.php
- WordPress filter from custom table is not working properly
- Configuring default woo commerce login with modal popup
- How to use information from the database in the front-end?
- Mailpoet Sign up on Custom registration form won’t work
- register_activation_hook doesn’t fire at all
- My ajax request don´t work and return 0
- How can I remove this sidebar from my Search Results page?
- How to allow customers to input a text as a product variation *and* charge per character?
- Create csv file in plugin
- How to make my plugin insert text into a custom div?
- Response from Php File to Ajax is not getting sent
- What is the source outline for a basic word press plugin?
- Submit posts in two different post types with the same form
- Like/Dislike plugin crawler problem
- How to rename files during upload to a random string?
- Redirect a specific User role not admins automatically to view the post that they just updated
- REST API – filters not working inside plugin class
- WordPress site server getting blocked due to resource abuse
- “Virtual” image in WP Media Library (external URL)
- How to fetch WordPress Gallery Images to a Custom Post Type?