Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function prosesCheck($nik){
- $c = curl_init("https://disdukcapil.tangerangkota.go.id/ceknik/cek");
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'GET');
- curl_setopt($c, CURLOPT_ENCODING, 'gzip, deflate');
- $headers = array();
- $headers[] = 'Connection: keep-alive';
- $headers[] = 'Cache-Control: max-age=0';
- $headers[] = 'Origin: https://disdukcapil.tangerangkota.go.id';
- $headers[] = 'Upgrade-Insecure-Requests: 1';
- $headers[] = 'Content-Type: application/x-www-form-urlencoded';
- $headers[] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
- $headers[] = 'Sec-Fetch-Dest: document';
- $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9';
- $headers[] = 'Sec-Fetch-Site: same-origin';
- $headers[] = 'Sec-Fetch-Mode: navigate';
- $headers[] = 'Sec-Fetch-User: ?1';
- $headers[] = 'Referer: https://disdukcapil.tangerangkota.go.id/ceknik/cek';
- $headers[] = 'Accept-Language: en,id;q=0.9,en-US;q=0.8,id-ID;q=0.7,zh;q=0.6,zh-HK;q=0.5,zh-CN;q=0.4,zh-TW;q=0.3';
- curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($c, CURLOPT_HEADER, 1);
- curl_setopt($c, CURLINFO_HEADER_OUT, true);
- $response = curl_exec($c);
- $token=get_between($response,'name="tokek" value="','">');
- $mysess=get_between($response,'myD3ti06gh42PHPSESSID=',';');
- $ci_session=get_between($response,'ci_session=',';');
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://disdukcapil.tangerangkota.go.id/ceknik/cek');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, "nik=$nik&tokek=$token&submit=Cek+NIK");
- curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
- $headers = array();
- $headers[] = 'Connection: keep-alive';
- $headers[] = 'Cache-Control: max-age=0';
- $headers[] = 'Origin: https://disdukcapil.tangerangkota.go.id';
- $headers[] = 'Upgrade-Insecure-Requests: 1';
- $headers[] = 'Content-Type: application/x-www-form-urlencoded';
- $headers[] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
- $headers[] = 'Sec-Fetch-Dest: document';
- $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9';
- $headers[] = 'Sec-Fetch-Site: same-origin';
- $headers[] = 'Sec-Fetch-Mode: navigate';
- $headers[] = 'Sec-Fetch-User: ?1';
- $headers[] = 'Referer: https://disdukcapil.tangerangkota.go.id/ceknik/cek';
- $headers[] = 'Accept-Language: en,id;q=0.9,en-US;q=0.8,id-ID;q=0.7,zh;q=0.6,zh-HK;q=0.5,zh-CN;q=0.4,zh-TW;q=0.3';
- $headers[] = 'Cookie: myD3ti06gh42PHPSESSID='.$mysess.'; ci_session='.$ci_session.'; _ga=GA1.3.1594471089.1585662472; _gid=GA1.3.1411642439.1585662472; _gat=1; _gat_gtag_UA_102493637_7=1';
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- $result = curl_exec($ch);
- // return $result;
- if(inStr($result,'Data tersebut tidak terdaftar di Database Disdukcapil Kota Tangerang')){
- return "$nik - Tidak Terdaftar \n";
- } else {
- return "$nik - Terdaftar \n";
- }
- }
- function inStr($s,$as) {
- $s=strtoupper($s);
- if(!is_array($as)) $as=array($as);
- for($i=0;$i<count($as);$i++) if(strpos(($s),strtoupper($as[$i]))!==false) return true;
- return false;
- }
- function get_between($string, $start, $end)
- {
- $string = " ".$string;
- $ini = strpos($string,$start);
- if ($ini == 0) return "";
- $ini += strlen($start);
- $len = strpos($string,$end,$ini) - $ini;
- return substr($string,$ini,$len);
- }
- $gasken = prosesCheck("MASUKAN NIK");
- echo $gasken;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement