Quantcast
Viewing all articles
Browse latest Browse all 2363

Re: Access core_user_get_users_by_field service with token generated by token api

by surya singh.  


Hello Carlos sir ,


it will work perfectly . 

use this link - https://github.com/moodlehq/sample-ws-clients/tree/master/PHP-XMLRPC 

try this code . 

<?php

// file_name : client.php

$token = 'f29f8b6b8e04bf2a883d28f2bad8f5a4';

$domainname = 'http://localhost/moodle';

$functionname = 'core_user_get_users';

//////// core_enrol_get_users_courses ////////

//$user = new stdClass();

$user['key'] = 'userid';

$user['value'] = '2';

/// PARAMETERS - NEED TO BE CHANGED IF YOU CALL A DIFFERENT FUNCTION

$params = array(array($user));

/// XML-RPC CALL 

print_r($params);

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, $params);

$resp = xmlrpc_decode($curl->post($serverurl, $post));

print_r($resp);

?>


Viewing all articles
Browse latest Browse all 2363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>