PHP code example of dimasahmad / dapodik-sdk

1. Go to this page and download the library: Download dimasahmad/dapodik-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dimasahmad / dapodik-sdk example snippets


$dapodik = new \DimasAhmad\Dapodik\SDK\Auth\WebService();
$dapodik->setAccessToken("accessToken"); // Token yang didapatkan saat registrasi aplikasi
$dapodik->setNpsn("12345678"); // NPSN server Dapodik yang akan diakses

$sekolah = new \DimasAhmad\Dapodik\SDK\Model\WebService\Sekolah($dapodik);

echo $sekolah->getNama();

$dapodik = new \DimasAhmad\Dapodik\SDK\Auth\Rest();
$dapodik->setUsername("[email protected]");
$dapodik->setPassword("password");

$dapodik->login();

$response = $dapodik->client->request("GET", "/rest/Sekolah");
$sekolah = json_decode($response->getBody()->__toString())->rows[0];

echo $sekolah->nama;

$dapodik->setProxyPort("localhost:8888");