unable to get records for core_course_get_courses service

unable to get records for core_course_get_courses service

by Sushma R -
Number of replies: 0

Hi Team,

I am very new to moodle concepts, i want to make use of webservices, most of the web services are giving me  error., 

Eg: core_course_get_courses -> i need details of all the courses,  below is the code snapshot, seems like i am missing something, it would be of great help if somebody help me on this, 

$token ='xxx'; 

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

$restformat = 'json'; 

$functionname = 'core_course_get_courses';

$params = '&courseid=[2]'; // tried for particular course also

header('Content-Type: text/plain');

$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);print_r($resp);

Thanks in advance,


Average of ratings: -