Show more code 😉
Here's a working example:
<?php
$path = 'http://localhost/test/ips_47_test/';
$key = 'd5921836b2c8343d890a5faccb9e73af';
//Private message test
$endpoint = '/core/messages';
$post = [
'from' => 1,
'to' => [2],
'title' => 'title of private message',
'body' => 'send by api',
];
$params = http_build_query($post);
$curl = curl_init($path . 'api' . $endpoint . '?' . $params);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_USERAGENT => "MyUserAgent/1.0",
CURLOPT_POST => 1,
CURLOPT_USERPWD => $key
));
curl_exec($curl);