<?php
$new_user = [
'username'=> usernamex1,
'email'=> email1@gmail.com,
'password'=>'abc123',
'api_bypass_permissions' => 1
];
$new_user = http_build_query($new_user);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://domain.com/api/users/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $new_user,
CURLOPT_HTTPHEADER => array(
'XF-Api-Key: xxxxxx',
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
echo '<pre>';
print_r($response);
echo '</pre>';
curl_close($curl);
echo $response;