Any errors?
(incomplete) PHP code looks like below:
USERNAME = "admin@mydomain.com";
PASSWORD = "mypassword";
//login
$curl = curl_init();
$data = array('username'=>USERNAME, 'password'=>PASSWORD);
$post = http_build_query($data);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://domain.com/iredadmin/api/login",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $post,
CURLOPT_SSL_VERIFYHOST=>false,
CURLOPT_SSL_VERIFYPEER=>false,
CURLOPT_COOKIEJAR=>dirname(__FILE__) . "/cookies.txt",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
//add user
$email = "test1@mydomain.com";
$curl = curl_init();
$data = array(
'name'=>"Test",
'password'=>"my-complex-password-@*/)",
'language'=>'en_US'
);
$post = http_build_query($data);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://domain.com/iredadmin/api/user/".$email,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $post,
CURLOPT_SSL_VERIFYHOST=>false,
CURLOPT_SSL_VERIFYPEER=>false,
CURLOPT_COOKIEFILE=>dirname(__FILE__) . "/cookies.txt",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo '<pre>';
print_r( $response);
echo '</pre>';
}