Sending JSON string through wp_remote_post()
I'm building a mailchimp integration and they require a POST call with JSON code.
No, I'm using this code that actually works:
$data = wp_remote_post($url, array(
'headers' = array('Content-Type' = 'application/json; charset=utf-8'),
'body' = json_encode($array_with_parameters),
'method' = 'POST'
));
But, it returns a PHP warning
Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in ../wp-includes/Requests/Transport/cURL.php on line 507
How to avoit it?
I've tried to just use the plain array in 'body' index but MailChimp returns a JSON parsing error.
Topic wp-remote-post plugin-mailchimp http-api json Wordpress
Category Web