Ok, I've searched a lot but cannot understand what I'm missing. I need to post some data to a php file on another server, but if I print the wp_remote_post variable I get:
{"headers":{},"body":"","response":{"code":200,"message":"OK"} .....
here the code:
$url = 'https://xxx.domain.net/api/api.php';
$args = array(
'method' => 'POST',
'timeout' => 45,
'sslverify' => false,
'headers' => array(
'Authorization' => 'xxxx',
'Content-Type' => 'application/json; charset=utf-8',
),
'body' => json_encode($attachment_fields),
'data_format' => 'body'
);
$request = wp_remote_post( $url, $args );
and $attachment_fields is an array built previously.
It seems that it sends it out (it says code 200) but in the php file the $_REQUEST (or $_POST) is empty... Sorry if is a stupid question but I'm struggling on it for a while..