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.
42 lines
1.4 KiB
42 lines
1.4 KiB
<?php
|
|
// This client for local_ws_evl 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_ws_evl
|
|
*
|
|
* 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 = 'ba67e5abeaf65bcb8397b39ebf1e1856'; //'49d164aa3585e3ff13c9ab1b123abd67';
|
|
$domainname = 'http://localhost/moodle';
|
|
|
|
/// FUNCTION NAME
|
|
$functionname = 'local_ws_evl_get_usage_statistics';
|
|
|
|
/// PARAMETERS
|
|
$welcomemsg = 'Hello, ';
|
|
|
|
///// 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());
|
|
$resp = xmlrpc_decode($curl->post($serverurl, $post));
|
|
print_r($resp);
|
|
//print_r ($post);
|
|
|