<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://belajar.awanpenggerak.id/webservice/rest/server.php?wstoken=2e7ec50172c04f9bcb43a7bbb54c9da8&wsfunction=core_user_get_users&moodlewsrestformat=json&criteria[0][key]=email&criteria[0][value]=%%',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response_user = curl_exec($curl);

curl_close($curl);

$data = json_decode($response_user, true);
$users = $data['users'];

$numberOfUsers = count($data['users']);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://belajar.awanpenggerak.id/webservice/rest/server.php?wstoken=2e7ec50172c04f9bcb43a7bbb54c9da8&wsfunction=core_course_get_categories&moodlewsrestformat=json',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response_category = curl_exec($curl);

curl_close($curl);

$data_category = json_decode($response_category, true);

$numberOfCategories = count($data_category);

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://belajar.awanpenggerak.id/webservice/rest/server.php?wstoken=2e7ec50172c04f9bcb43a7bbb54c9da8&wsfunction=core_course_get_courses&moodlewsrestformat=json',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response_course = curl_exec($curl);

curl_close($curl);

$data_course = json_decode($response_course, true);

$numberOfCourses = count($data_course);


?>