Ejemplo n.º 1
0
</form>

<?php 
if ($groupid && $userid) {
    var_dump($CFG->serverurl . '/group/add_groupmember');
    //we are asking for a token
    $connectiondata['username'] = '******';
    $connectiondata['password'] = '******';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/user/get_token');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
    $token = curl_exec($ch);
    $data['token'] = $token;
    $data['groupid'] = $groupid;
    $data['userid'] = $userid;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/group/add_groupmember');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
    $out = curl_exec($ch);
    $res = basicxml_xml_to_object($out);
    show_object($res->result);
    show_xml($out);
} else {
    echo "<p>Fill the form first</p>";
}
end_interface();
Ejemplo n.º 2
0
<?php

/**
 * Created on 10/17/2008
 *
 * Rest Test Client
 *
 * @author David Castro Garcia
 * @author Ferran Recio Calderó
 * @author Jerome Mouneyrac
 * @author Jordi Piguillem
 */
require_once 'config_rest.php';
start_interface(false);
$links = array(array('USERS'), array('getusers.php', 'get_users()'), array('createuser.php', 'create_user()'), array('deleteuser.php', 'delete_user()'), array('updateuser.php', 'update_user()'), array('GROUPS'), array('creategroup.php', 'create_group()'), array('addgroupmember.php', 'add_groupmember()'), array('getgroup.php', 'get_group()'));
echo '<ul>';
foreach ($links as $link) {
    if (sizeof($link) == 2) {
        echo '<li><a href="' . $link[0] . '">' . $link[1] . '</a></li>';
    } else {
        echo '</ul><h2>' . $link[0] . '</h2><ul>';
    }
}
echo '</ul>';
end_interface(false);