// Require ODR API demo class
require_once '../Api/Odr.php';
// Configuration array, with user API Keys
$config = array('api_key' => '#API_KEY#', 'api_secret' => '#API_SECRET#');
// Create new instance of API demo class
$demo = new Api_Odr($config);
// Login into API
$demo->login();
$loginResult = $demo->getResult();
if ($loginResult['status'] === Api_Odr::STATUS_ERROR) {
    echo 'Can\'t login, reason - ' . $loginResult['response'];
    exit(1);
}
if (empty($_REQUEST['__sent'])) {
    $demo->info('/domain/test.eu/', Api_Odr::METHOD_POST);
    $info = $demo->getResult();
    $form = '<form action="" method="post">';
    foreach ($info['response']['fields'] as $name => $field) {
        $form .= '<div style="margin-bottom: 10px;">' . fieldToHtml($name, $field) . '</div>';
    }
    $form .= '<button type="submit" name="__sent">Submit generated form</button>';
    $form .= '</form>';
    echo $form;
} else {
    // Submit the data, it's located in the $_POST variable
}
/**
 * Converts info response to HTML input
 * Notice! This is a bare-bone function, it doesn't wrap generated input or display help or anything
 * It just builds input