Created
September 7, 2014 22:43
-
-
Save jleyva/8d0978ec75011d9bcb94 to your computer and use it in GitHub Desktop.
MDL-46054
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 = '1c64c9f95d565cab6e1285e75356ce35'; | |
$domainname = 'http://localhost/moodlebugs'; | |
$functionname = 'mod_forum_get_forum_discussions'; | |
$params = array(array(2)); | |
header('Content-Type: text/plain'); | |
$serverurl = $domainname . '/webservice/xmlrpc/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname; | |
require_once('./curl.php'); | |
$curl = new curl; | |
echo "========== FIRST RESPONSE ==============\n\n"; | |
$post = xmlrpc_encode_request($functionname, $params); | |
$resp = xmlrpc_decode($curl->post($serverurl, $post)); | |
print_r($resp); | |
echo "========== SECOND RESPONSE ==============\n\n"; | |
$params = array(array(2), 0, 1); | |
$post = xmlrpc_encode_request($functionname, $params); | |
$resp = xmlrpc_decode($curl->post($serverurl, $post)); | |
print_r($resp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment