Inconsistencies between wp_remote_post and cURL

As discovered above, headers need to be (seems so obvious now) key-value pairs, as opposed to an array of json-style key-values: $headers = array(); $headers[‘Content-Type’] = ‘application/json’; $headers[‘Api-Key’] = ‘{myapikey}’; $headers[‘Siteid’] = ‘99999’; And the body needs to be json so either: ‘body’ => “{\n \”Username\”: \”Siteowner\”,\n \”Password\”: \”apitest1234\”\n}” or ‘body’ => json_encode(array( ‘Username’ => … Read more

Call external API in wordpress based on user input

s is a reserved keyword, you cannot reuse the URL parameters and query variables used by WordPress itself. This issue is unrelated to the API request code. Because your form has an input with the name s, the request is interpreted as a search request. As no posts were found in the WordPress search, you … Read more