<?php
$pddiktiUrl = 'http://103.167.112.188:8100/ws/live2.php';

// Get Token
$ch = curl_init($pddiktiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['act' => 'GetToken', 'username' => '083043', 'password' => 'itka123#']));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);

$token = json_decode($response, true)['data']['token'];

// Get Penugasan
$ch = curl_init($pddiktiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['act' => 'GetListPenugasanSemuaDosen', 'token' => $token, 'limit' => 1]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);

var_dump(json_decode($response, true)['data'][0]);
