Created
July 23, 2014 21:28
-
-
Save jleyva/04d0e60d45916523b059 to your computer and use it in GitHub Desktop.
MDL-45303
This file contains hidden or 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 | |
/// SETUP - NEED TO BE CHANGED | |
$token = '689f261a74ff51d54b01c4da8921ca83'; | |
$domainname = 'http://localhost/moodlebugs'; | |
$functionname = 'mod_forum_get_forum_discussions'; | |
// 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 | |
$params = array('forumids' => array(5), 'limitfrom' => 0, 'limitnum' => 10); | |
/// REST CALL | |
header('Content-Type: text/plain'); | |
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname; | |
require_once('./curl.php'); | |
$curl = new curl; | |
//if rest format == 'xml', then we do not add the param for backward compatibility with Moodle < 2.2 | |
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:''; | |
$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