SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html><head><style>
  2. table, th, td {
  3.   border: 1px solid black;
  4.   border-spacing: 0px;
  5. }
  6. </style>
  7. <script>
  8.  function change(gbr){
  9.      document.getElementById("gambarmas").innerHTML = "<img src="+gbr+">";
  10.  };
  11. </script>
  12. </head>
  13. <body>
  14. <?php
  15. /*
  16. PHP KPU Grabber
  17. Script ini dibuat karena galau susah scroll di web KPU karena kurang user friendly
  18. catatan: aktifkan extension=php_openssl di php.ini agar bisa grab https
  19. issue: data web KPU kadang gagal diambil, ada gambar c1 yang tidak tersedia,
  20. */
  21. set_time_limit(0);
  22. $prov=$_GET['p'];
  23. $kab=$_GET['b'];
  24. $kec=$_GET['c'];
  25. $kel=$_GET['l'];
  26. $tps=$_GET['t'];
  27. $pn=$_GET['pn'];
  28. $bn=$_GET['bn'];
  29. $cn=$_GET['cn'];
  30. $ln=$_GET['ln'];
  31. $tn=$_GET['tn'];
  32.  
  33. //NEGARA
  34. if(!isset($prov)){
  35. //list prov
  36. echo "INDONESIA <p>";
  37. $data=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/0.json");
  38. //hasil prov
  39. $data2=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp.json");
  40.  
  41. $a = json_decode($data,true);
  42. $h = json_decode($data2,true);
  43. echo "<table><tr><th>PROV <th>01 <th> 02<tr><td>Total Suara Masuk<td>".$h[chart][21]."<td>".$h[chart][22];
  44.  
  45. foreach ($a as $v1=>$b) {
  46.     echo "<tr><td><a href='?p=$v1&pn=$b[nama]'>$b[nama]</a><td>".$h[table][$v1][21]."<td>".$h[table][$v1][22];
  47. }
  48. echo "<tr><td>Total Suara Masuk<td>".$h[chart][21]."<td>".$h[chart][22]."<tr><td>Jml TPS total/diproses<td>".$h[progress][total]."<td>".$h[progress][proses]."</table>";
  49. }
  50.  
  51. if(!isset($kab) && isset($prov) && $prov !==""){
  52.     echo "<a href='?'>INDONESIA</a> <a href='?p=$prov&pn=$pn'>$pn</a><p>";
  53.     $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov.json");
  54.     $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov.json");
  55.    
  56.     $jp=json_decode($dp,true);
  57.     $jph=json_decode($dph,true);
  58.     //echo "<pre>";
  59.     echo "<table><tr><th>KAB/KOTA <th>01 <th> 02";
  60.     foreach ($jp as $jpv1=>$bp) {
  61.     echo "<tr><td><a href='?p=$prov&pn=$pn&b=$jpv1&bn=$bp[nama]'>$bp[nama]</a><td>".$jph[table][$jpv1][21]."<td>".$jph[table][$jpv1][22];
  62. }
  63. echo "</table>";
  64. }
  65. if(!isset($kec) && isset($kab) && $kab !==""){
  66.     echo "<a href='?'>INDONESIA</a> <a href='?p=$prov&pn=$pn'>$pn</a> <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn'>$bn</a><p>";
  67.     $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov/$kab.json");
  68.     //https://pemilu2019.kpu.go.id/static/json/wilayah/41863/41864.json
  69.     $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab.json");
  70.    
  71.     $jp=json_decode($dp,true);
  72.     $jph=json_decode($dph,true);
  73.     //echo "<pre>";
  74.     echo "<table><tr><th>KECAMATAN <th>01 <th> 02";
  75.     foreach ($jp as $jpv1=>$bp) {
  76.     echo "<tr><td><a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$jpv1&cn=$bp[nama]'>$bp[nama]</a><td>".$jph[table][$jpv1][21]."<td>".$jph[table][$jpv1][22];
  77. }
  78. echo "</table><pre>";
  79. //  print_r($jp);print_r($jph);
  80. }
  81.  
  82. if(!isset($kel) && isset($kec) && $kec !==""){
  83.     echo "<a href='?'>INDONESIA</a> <a href='?p=$prov&pn=$pn'>$pn</a> <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn'>$bn</a> <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn'>$cn</a><p>";
  84.     $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov/$kab/$kec.json");
  85.     //https://pemilu2019.kpu.go.id/static/json/wilayah/41863/41864.json
  86.     $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec.json");
  87.    
  88.     $jp=json_decode($dp,true);
  89.     $jph=json_decode($dph,true);
  90.     //echo "<pre>";
  91.     echo "<table><tr><th>KELURAHAN <th>01 <th> 02";
  92.     foreach ($jp as $jpv1=>$bp) {
  93.     $suarajokowi=$jph[table][$jpv1][21];
  94.     //if($suarajokowi==""){$suarajokowi="belum tersedia";}
  95.     echo "<tr><td><a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn&l=$jpv1&ln=$bp[nama]&'>$bp[nama]</a><td>".$suarajokowi."<td>".$jph[table][$jpv1][22];
  96. }
  97. echo "</table><pre>";
  98. //  print_r($jp);print_r($jph);
  99. }
  100.  
  101.  
  102. if(!isset($tps) && isset($kel) && $kel !==""){
  103.     echo "<a href='?'>INDONESIA</a><br>
  104.           <a href='?p=$prov&pn=$pn'>$pn</a><br>
  105.           <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn'>$bn</a><br>
  106.           <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn'>$cn</a><br>
  107.           <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn&l=$kel&ln=$ln'>$ln</a><p>";
  108.     $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov/$kab/$kec/$kel.json");
  109.     //https://pemilu2019.kpu.go.id/static/json/wilayah/41863/41864.json
  110.     $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec/$kel.json");
  111.  
  112.     $datakp=curlget("https://kawal-c1.appspot.com/api/c/$kel");
  113.    
  114.    
  115.     $jp=json_decode($dp,true);
  116.     $jph=json_decode($dph,true);
  117.     $jkp=json_decode($datakp,true);
  118.     //echo "<pre>";
  119.     echo "<table><tr><th>TPS <th>01 <th> 02<th>sah<th>01+02<th> 01 (KP)<th>02 (KP)";
  120.     $x=1;
  121.     foreach ($jp as $jpv1=>$bp) {
  122.        $dphtps=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec/$kel/$jpv1.json");
  123.        $jphtps=json_decode($dphtps,true);
  124.        $suman = (int)$jph[table][$jpv1][21] + (int)$jph[table][$jpv1][22];
  125.  
  126.         echo "<tr><td><a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn&l=$kel&ln=$ln&t=$jpv1&tn=$bp[nama]'>$bp[nama]</a><td>".$jph[table][$jpv1][21]."<td>".$jph[table][$jpv1][22]."<td>".$jphtps[suara_sah]."<td>".$suman."<td>".$jkp[data][$x][sum][pas1]."<td>".$jkp[data][$x][sum][pas2];
  127.    
  128.     $x++;
  129. }
  130. echo "</table><pre>";
  131. //  print_r($jp);print_r($jph);
  132. }
  133.  
  134. if(isset($tps) && $tps !==""){
  135.     echo "<a href='?'>INDONESIA</a><br>
  136.           <a href='?p=$prov&pn=$pn'>$pn</a><br>
  137.           <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn'>$bn</a><br>
  138.           <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn'>$cn</a><br>
  139.           <a href='?p=$prov&pn=$pn&b=$kab&bn=$bn&c=$kec&cn=$cn&l=$kel&ln=$ln'>$ln</a><br>
  140.           $tn<p>";
  141.     $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec/$kel/$tps.json");
  142.    
  143.     $jph=json_decode($dph,true);
  144.     $kode=substr($tps,3,3);
  145.     $gbr1="https://pemilu2019.kpu.go.id/img/c/900/$kode/$tps/".$jph[images][0];
  146.     $gbr2="https://pemilu2019.kpu.go.id/img/c/900/$kode/$tps/".$jph[images][1];
  147.     echo "<table><tr><th>TPS<th>01<th>02<th>Jumlah Pemilih<th>Suara Sah<th>Suara Tidak Sah<th>Total Suara<th>Gambar";
  148.     echo "<tr><td>$tn<td>".$jph[chart][21]."<td>".$jph[chart][22]."<td>$jph[pemilih_j]<td>$jph[suara_sah]<td>$jph[suara_tidak_sah]<td>$jph[suara_total]<td><button onclick=change('$gbr1')>gbr1</button> <button onclick=change('$gbr2')>gbr2</button>";
  149.  
  150. echo "</table><div id=gambarmas></div>";
  151. }
  152.  
  153. function curlget($url){
  154.     $ch = curl_init();
  155.     $agent=$_SERVER['HTTP_USER_AGENT'];
  156.     curl_setopt($ch, CURLOPT_URL, $url);
  157.     curl_setopt($ch,CURLOPT_USERAGENT,$agent);
  158.     curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
  159.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  160.     $output = curl_exec($ch);
  161.     curl_close($ch);      
  162.     return $output;
  163. }
  164. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top