Hi,
please help, bacause I have some problem with function: core_user_get_users_by_field.
This code works for me:
header('Content-Type: text/plain');
$params = array('field' => 'email','values[0]'=>'....@....');
$restformat = 'xml';
$functionname = 'core_user_get_users_by_field';
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname;
require_once('./curl.php');
$curl = new curl;
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:'';
$resp = $curl->post($serverurl . $restformat, $params);//, $params
print_r($resp);
but this not works:
header('Content-Type: text/plain');
$functionname = 'core_user_get_users_by_field';
$params = array('field' => 'email','values'=>array('...@....'));
$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);
Why? I have enabled all protocols.
I also tried: array($params), array(array($params)), but same problem.
I found detailed error:
field => Scalar type expected, array or object received.