Ini adalah Cara Mengambil data JSON dari WEB SERVICE yang saya pernah posting Sebelumnya dengan judul Membuat Validasi Ip Address atau IP Filter dalam Fungsi Web Service dengan WEB API 2 C# VS2013 Dengan Database Mysql Jika kalian juga membuat fungsi IP Filter bisa di coba disini
ini lah cara Cepat mengambil Data JSON dari WEB SERVICE :
<?php // request list of contacts from Web API $url='http://localhost/rusunservices/api/penghuni/getallpenghuni/'.$_GET["awal"].'/'.$_GET["jumlah"]; $json = file_get_contents($url); // deserialize data from JSON $contacts = json_decode($json,true); //var_dump($contacts); ?> <table border='1'> <th>No</th> <th>No KTP</th> <th>Nama</th> <th>Tanggal Daftar</th> <?php $no=0; foreach($contacts['Records'] as $contact) { $no++; foreach ($contact as $key => $value ) { $$key=$value; } ?> <tr> <td valign="top"> <?php echo $no ?> </td> <td valign="top"> <?php echo $no_ktp ?> </td> <td valign="top"> <?php echo $nama_penghuni ?> </td> <td valign="top"> <?php echo $tgl_daftar ?> </td> </tr> <?php } //echo " Total records :". $contacts['TotalRecordCount']; //echo "/ Jumlah yang di keluarkan ".$_GET["jumlah"]." record "; ?> </table>
jika kalian mencoba data di atas 100 ribuan silahkan tambah perintah ini paling atas :
ini_set(‘memory_limit’, ‘1024M’); // or you could use 1G
karena jika tidak akan overload
untuk fungsi IP Filter yang berinteraksi adalah ip server yang memanggil WEB SERVICE tersebut, tetapi berlaku tidak untuk pemakai ip address end user bisa kita liat gambar nya di posting sebelum nya di Membuat Validasi Ip Address atau IP Filter dalam Fungsi Web Service dengan WEB API 2 C# VS2013 Dengan Database Mysql
Selamat Mencoba 🙂