You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
2 years ago
|
<?php
|
||
|
// This client for local_wstemplate 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.
|
||
|
//
|
||
|
|
||
|
/**
|
||
|
* XMLRPC client for Moodle 2 - local_wsilb
|
||
|
*
|
||
|
* This script does not depend of any Moodle code,
|
||
|
* and it can be called from a browser.
|
||
|
*
|
||
|
* @authorr Jerome Mouneyrac
|
||
|
*/
|
||
|
|
||
|
/// MOODLE ADMINISTRATION SETUP STEPS
|
||
|
// 1- Install the plugin
|
||
|
// 2- Enable web service advance feature (Admin > Advanced features)
|
||
|
// 3- Enable XMLRPC protocol (Admin > Plugins > Web services > Manage protocols)
|
||
|
// 4- Create a token for a specific user and for the service 'My service' (Admin > Plugins > Web services > Manage tokens)
|
||
|
// 5- Run this script directly from your browser: you should see 'Hello, FIRSTNAME'
|
||
|
|
||
|
|
||
|
/// SETUP - NEED TO BE CHANGED
|
||
|
$token = '2c4c550b3710b648dd7743d446884211';
|
||
|
$domainname = 'http://localhost/saberes';
|
||
|
|
||
|
/// FUNCTION NAME
|
||
|
$functionname = 'mod_sga_get_notas_curso';
|
||
|
|
||
|
/// PARAMETERS
|
||
|
$codCurso = 123;
|
||
|
|
||
|
///// XML-RPC CALL
|
||
|
header('Content-Type: text/plain');
|
||
|
$serverurl = $domainname . '/webservice/xmlrpc/server.php'. '?wstoken=' . $token;
|
||
|
require_once('./curl.php');
|
||
|
$curl = new curl;
|
||
|
$post = xmlrpc_encode_request($functionname, array($codCurso));
|
||
|
$resp = xmlrpc_decode($curl->post($serverurl, $post));
|
||
|
print_r($resp);
|