I'm trying to send a post request to a locally hosted app that generates critical CSS. Here is the code I'm using.
$url = 'http://localhost:4000/';
$urls->urls = 'https://www.domain.com';
$data = wp_remote_post($url, array(
'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
'body' => json_encode($urls),
'method' => 'POST',
'data_format' => 'body',
));
It returns this error: SyntaxError: Unexpected token u in JSON at position 0.
Here is a working example in Postman. Any idea on why my code isn't working?