Calling auth_userkey_request_login_url function using REST API

Calling auth_userkey_request_login_url function using REST API

by Philippe Requet -
Number of replies: 1

Hello,

Sorry for my english, i'm french and i'm having a problem using curl...

Here is my code (i saw it on another post on this forum) :

require_once('../src/dcai/curl.php');

    $token        = 'b98c67341a308b9cffd692b5b300b306';

    $domainname   = 'http://testals.arkesys.fr';

    $functionname = 'auth_userkey_request_login_url';

$idnumber = array( 'key' => 'idnumber' ,  'value' => 2 );

$params = array( 'criteria' => array($idnumber));

$server_url = $domainname . '/webservice/rest/server.php' . '?wstoken=' . $token . '&wsfunction=' . $functionname;

$curl = new dcai\curl();

$rest_format = '&moodlewsrestformat=json';

$resp = $curl->post($server_url . $rest_format, $params);

$resp     = json_decode($resp);

$loginurl = $resp->loginurl;


But if i try, i have an error :

 Undefined property: stdClass::$loginurl in D:\WampInstall2\wamp64\www\moodleold\Test\PNTest\curl-master\examples\test.php on line 43


Do you know how i can get the login URL, and where is my error ?

Thanks for your help, i'm lost...

Average of ratings: -
In reply to Philippe Requet

Re: Calling auth_userkey_request_login_url function using REST API

by Ester Rodríguez Mayorga -

Try this:


$params = Array('user' => Array('idnumber' => $idnumber) );


It works for me with the username, but with idnumber must to works.


Ester