<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://tester.eye.my.id/ws/live2.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$payload = json_encode(['act' => 'GetToken', 'username' => 'pddikti.itka@gmail.com', 'password' => '123456789']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$res = json_decode(curl_exec($ch), true);
$token = $res['data']['token'] ?? null;

if (!$token) {
    die("No token\n");
}

$payload2 = json_encode([
    'act' => 'GetPerguruanTinggi', 
    'token' => $token, 
    'filter' => "nama_perguruan_tinggi LIKE '%Universitas Gadjah Mada%'", 
    'limit' => 5
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload2);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$start = microtime(true);
$res2 = curl_exec($ch);
echo 'Time: ' . (microtime(true) - $start) . "s\n";
echo substr($res2, 0, 500);
