Here's my code:
And I get this response:
<?php
define('XENFORO_API_KEY', 'my_API_key_here');
define('XENFORO_BASE_URL', 'https://members.printondemandcoach.com/api');
$url = XENFORO_BASE_URL . '/users';
$data = [
'username' => 'testuser',
'email' => 'testuser@example.com',
'user_group_id' => 2
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'XF-Api-Key: ' . XENFORO_API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
echo $response;
And I get this response:
Not Found
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.