Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2363

Error creating users via the web service

$
0
0
by Xollie Mdlalose.  

Hi,

I am new to moodle and I am struggling to create 100 users via the core user create users api using php

I am able to create 7 or less users but once I push 20 or more i get an error message of which I think its because of the Rest maximum URL lengthsad

How can I solve this, please see my code snippet below

$tokenurl = 'http://myserver/login/token.php?username=admin&password=Admin&service=Students';


$tokenresponse = file_get_contents($tokenurl);


$tokenobject = json_decode($tokenresponse);


if (!empty($tokenobject->error)) {

    echo $tokenobject->error;

    die();

}


$users = array(array($BulkUserImport)); //BulkUserImport is an array containing 100 students 


$params = array(

    'wstoken' => $tokenobject->token,

    'wsfunction' => 'core_user_create_users',

    'moodlewsrestformat' => 'json',

    'users' => $users,

);


Viewing all articles
Browse latest Browse all 2363

Trending Articles



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