"; $data=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/0.json"); //hasil prov $data2=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp.json"); $a = json_decode($data,true); $h = json_decode($data2,true); echo "
PROV 01 02
Total Suara Masuk".$h['chart'][21]."".$h['chart'][22]; foreach ($a as $v1=>$b) { echo "
$b[nama]".$h['table'][$v1][21]."".$h['table'][$v1][22]; } echo "
Total Suara Masuk".$h['chart'][21]."".$h['chart'][22]."
Jml TPS total/diproses".$h[progress][total]."".$h[progress][proses]."
"; } if(!isset($kab) && isset($prov) && $prov !==""){ echo "INDONESIA $pn

"; $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov.json"); $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov.json"); $jp=json_decode($dp,true); $jph=json_decode($dph,true); //echo "

";
	echo "
KAB/KOTA 01 02"; foreach ($jp as $jpv1=>$bp) { echo "
$bp[nama]".$jph['table'][$jpv1][21]."".$jph['table'][$jpv1][22]; } echo "
"; } if(!isset($kec) && isset($kab) && $kab !==""){ echo "INDONESIA $pn $bn

"; $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov/$kab.json"); //https://pemilu2019.kpu.go.id/static/json/wilayah/41863/41864.json $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab.json"); $jp=json_decode($dp,true); $jph=json_decode($dph,true); //echo "

";
	echo "
KECAMATAN 01 02"; foreach ($jp as $jpv1=>$bp) { echo "
$bp[nama]".$jph['table'][$jpv1][21]."".$jph['table'][$jpv1][22]; } echo "
";
//	print_r($jp);print_r($jph);
}

if(!isset($kel) && isset($kec) && $kec !==""){
	echo "INDONESIA $pn 
$bn $cn

"; $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov/$kab/$kec.json"); //https://pemilu2019.kpu.go.id/static/json/wilayah/41863/41864.json $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec.json"); $jp=json_decode($dp,true); $jph=json_decode($dph,true); //echo "

";
	echo "
KELURAHAN 01 02"; foreach ($jp as $jpv1=>$bp) { $suarajokowi=$jph['table'][$jpv1][21]; //if($suarajokowi==""){$suarajokowi="belum tersedia";} echo "
$bp[nama]".$suarajokowi."".$jph['table'][$jpv1][22]; } echo "
";
//	print_r($jp);print_r($jph);
}


if(!isset($tps) && isset($kel) && $kel !==""){
	echo "INDONESIA $pn 
$bn $cn $ln

"; $dp=curlget("https://pemilu2019.kpu.go.id/static/json/wilayah/$prov/$kab/$kec/$kel.json"); //https://pemilu2019.kpu.go.id/static/json/wilayah/41863/41864.json $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec/$kel.json"); $datakp=curlget("https://kawal-c1.appspot.com/api/c/$kel"); $jp=json_decode($dp,true); $jph=json_decode($dph,true); $jkp=json_decode($datakp,true); //echo "

";
	echo "
TPS 01 02 01 (KP)02 (KP)"; $x=1; foreach ($jp as $jpv1=>$bp) { $beda="";$beda2=""; if(isset($jph['table'][$jpv1][21]) && isset($jkp['data'][$x]['sum']['pas1']) && $jph['table'][$jpv1][21] !== $jkp['data'][$x]['sum']['pas1']){$beda="";} if(isset($jph['table'][$jpv1][22]) && isset($jkp['data'][$x]['sum']['pas2']) && $jph['table'][$jpv1][22] !== $jkp['data'][$x]['sum']['pas2']){$beda="";} echo "
$bp[nama]".$jph['table'][$jpv1][21]."".$jph['table'][$jpv1][22]."$beda".$jkp['data'][$x]['sum']['pas1']."$beda".$jkp['data'][$x]['sum']['pas2']; $x++; } echo "
";
//	print_r($jp);print_r($jph);
}

if(isset($tps) && $tps !==""){
	echo "INDONESIA $pn 
$bn $cn $ln 
$tn

"; $dph=curlget("https://pemilu2019.kpu.go.id/static/json/hhcw/ppwp/$prov/$kab/$kec/$kel/$tps.json"); $jph=json_decode($dph,true); $kode=substr($tps,3,3); $gbr1="https://pemilu2019.kpu.go.id/img/c/900/$kode/$tps/".$jph['images'][0]; $gbr2="https://pemilu2019.kpu.go.id/img/c/900/$kode/$tps/".$jph['images'][1]; echo "
TPS0102Jumlah PemilihSuara SahSuara Tidak SahTotal SuaraGambar"; echo "
$tn".$jph['chart'][21]."".$jph['chart'][22]."".$jph['pemilih_j']."".$jph['suara_sah']."".$jph['suara_tidak_sah']."".$jph['suara_total']." "; echo "

"; } function curlget($url){ $ch = curl_init(); $agent=$_SERVER['HTTP_USER_AGENT']; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_USERAGENT,$agent); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); return $output; } ?>