<?php
$url = 'http://103.163.138.38:8100/ws/live2.php';
$username = '082006';
$password = 'itka2024';

function req($url, $data) {
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
    $res = curl_exec($ch);
    curl_close($ch);
    return json_decode($res, true);
}

$tokenData = req($url, ['act' => 'GetToken', 'username' => $username, 'password' => $password]);
$token = $tokenData['data']['token'];

// Pull 5 classes from 2024/2025 Genap or whatever
$data = req($url, ['act' => 'GetListKelasKuliah', 'token' => $token, 'filter' => "id_semester='20252'", 'order' => '', 'limit' => 5, 'offset' => 0]);
print_r($data['data']);
