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

"Context does not exist" error

$
0
0
by Lilian hugues.  

hi folks,

I'm under Moodle 2.3

I'm trying to enrol a student to a course using a rest web service.

I'm receiving the message "Context does not exist" as an invalidparameter.

Here is my code. 

******************************************

/// SETUP - NEED TO BE CHANGED
$token = 'd6b89e0ebdd2667e16830e0c8b1093fa';
$domainname = 'http://ludirm.medzone.fr';
$functionname = 'enrol_manual_enrol_users';

//////// ////////

$enrolment = array(
'roleid' => 5,
'userid' => 24,
'courseid' => 69
);
$enrolments = array( $enrolment );
$params = array( 'enrolments' => $enrolments );


/// REST CALL
header('Content-Type: text/plain');
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname;
require_once('./curl.php');
$curl = new curl;

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

*****************************************

If anybody has any idea, I'll be greatful. I've been trying to fix it for couple of hours now.

Many thanks in advance for your support.

Lilian


Viewing all articles
Browse latest Browse all 2362

Trending Articles



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