Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getCurl($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);
- $result = curl_exec($ch);
- curl_close($ch);
- return json_decode($result, true);
- }
- $kode_wilayah1 = "190200"; // Kab.Pangkep
- // alamat API
- $url_daftar_sekolah = "http://jendela.data.kemdikbud.go.id/api/index.php/Csekolah/rekapSekolahGET?mst_kode_wilayah=".$kode_wilayah1;
- $result =getCurl($url_daftar_sekolah);
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Daftar Sekolah</title>
- </head>
- <body>
- <table>
- <tr>
- <th>Kecamatan</th>
- <th>Kategori</th>
- <th>Jumlah</th>
- </tr>
- <?php foreach($result as $row) : ?>
- <tr>
- <td><?= $row['data']['wilayah']; ?></td>
- <td><?= $row['data']['bentuk']; ?></td>
- <td><?= $row['data']['sekolah']; ?></td>
- </tr>
- <?php endforeach; ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement