</table> </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();
* @author David Castro Garcia * @author Ferran Recio Calderó * @author Jerome Mouneyrac */ require_once 'config_rest.php'; start_interface("Create A User"); $ch = curl_init(); $data['username'] = "******"; $data['firstname'] = "mockuser5"; $data['lastname'] = "mockuser5"; $data['email'] = "*****@*****.**"; var_dump($data); //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; curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/user/create_user'); 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->userid); show_xml($out); end_interface();
</table> </form> <?php if ($groupname && $courseid) { var_dump($CFG->serverurl . '/group/create_group'); //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['groupname'] = $groupname; $data['courseid'] = $courseid; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/group/create_group'); 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->groupid); show_xml($out); } else { echo "<p>Fill the form first</p>"; } end_interface();
"/></td></tr> <tr><td></td><td><input type="submit" value="Find Group"></td></tr> </table> </form> <?php if ($groupid) { //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; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/group/get_group'); 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->return); show_xml($out); } else { echo "<p>Fill the form first</p>"; } end_interface();
"/></td></tr> <tr><td></td><td><input type="submit" value="Find Users"></td></tr> </table> </form> <?php if ($search) { $data['search'] = $search; //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; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/user/get_users'); 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->user, 2, 'auth'); show_xml($out); } else { echo "<p>Fill the form first</p>"; } end_interface();
"/></td></tr> <tr><td></td><td><input type="submit" value="Delete Group"></td></tr> </table> </form> <?php if ($groupid) { //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; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $CFG->serverurl . '/group/delete_group'); 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); show_xml($out); } else { echo "<p>Fill the form first</p>"; } end_interface();