<?php
// Test client for enroll endpoint
$url = 'http://localhost/smartthink/website/api/enroll.php';

$payload = [
    'course_id' => 1,
    'first_name' => 'GuestFirst',
    'last_name' => 'GuestLast',
    'email' => 'guest+' . rand(1000,9999) . '@example.com',
    'password' => ''
];

$options = [
    'http' => [
        'header'  => "Content-type: application/json\r\n",
        'method'  => 'POST',
        'content' => json_encode($payload),
        'timeout' => 30
    ]
];
$context  = stream_context_create($options);
$result = @file_get_contents($url, false, $context);
if ($result === false) {
    echo "Request failed\n";
    var_dump($http_response_header);
} else {
    echo $result;
}
