Last active
August 29, 2015 13:57
-
-
Save jleyva/9551523 to your computer and use it in GitHub Desktop.
MDL-44603
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This file is NOT a part of Moodle - http://moodle.org/ | |
// | |
// This client for Moodle 2 is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// | |
/** | |
* REST client for Moodle 2 | |
* Return JSON or XML format | |
* | |
* @author Jerome Mouneyrac | |
*/ | |
/// SETUP - NEED TO BE CHANGED | |
$token = '4179609b36b2908e20d375011f42754e'; | |
//$token = '1bf9fbe8f592e895ba7dc27de75a1a73'; | |
$domainname = 'http://localhost/moodlebugs'; | |
//$domainname = 'http://localhost/m/stable_24'; | |
// REST RETURNED VALUES FORMAT | |
$restformat = 'json'; //Also possible in Moodle 2.2 and later: 'json' | |
//Setting it to 'json' will fail all calls on earlier Moodle version | |
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:''; | |
/// REST CALL | |
header('Content-Type: text/plain'); | |
require_once('./curl.php'); | |
$curl = new curl; | |
$functionname = 'core_grading_get_definitions'; | |
$params = array('cmids' => array(1), 'areaname' => 'submissions', 'activeonly' => 0); | |
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname; | |
$resp = $curl->post($serverurl . $restformat, $params); | |
print_r($resp); | |
/* | |
$functionname = 'core_grading_get_gradingform_instances'; | |
$params = array('definitionid' => 1, 'since' => 0); | |
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname; | |
$resp = $curl->post($serverurl . $restformat, $params); | |
print_r($resp);*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment