Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. <?php
  2. function prosesCheck($nik){
  3. $c = curl_init("https://disdukcapil.tangerangkota.go.id/ceknik/cek");
  4. curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  5. curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'GET');
  6. curl_setopt($c, CURLOPT_ENCODING, 'gzip, deflate');
  7. $headers = array();
  8. $headers[] = 'Connection: keep-alive';
  9. $headers[] = 'Cache-Control: max-age=0';
  10. $headers[] = 'Origin: https://disdukcapil.tangerangkota.go.id';
  11. $headers[] = 'Upgrade-Insecure-Requests: 1';
  12. $headers[] = 'Content-Type: application/x-www-form-urlencoded';
  13. $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';
  14. $headers[] = 'Sec-Fetch-Dest: document';
  15. $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';
  16. $headers[] = 'Sec-Fetch-Site: same-origin';
  17. $headers[] = 'Sec-Fetch-Mode: navigate';
  18. $headers[] = 'Sec-Fetch-User: ?1';
  19. $headers[] = 'Referer: https://disdukcapil.tangerangkota.go.id/ceknik/cek';
  20. $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';
  21. curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
  22. curl_setopt($c, CURLOPT_HEADER, 1);
  23. curl_setopt($c, CURLINFO_HEADER_OUT, true);
  24. $response = curl_exec($c);
  25. $token=get_between($response,'name="tokek" value="','">');
  26. $mysess=get_between($response,'myD3ti06gh42PHPSESSID=',';');
  27. $ci_session=get_between($response,'ci_session=',';');
  28.  
  29.  
  30. $ch = curl_init();
  31.  
  32. curl_setopt($ch, CURLOPT_URL, 'https://disdukcapil.tangerangkota.go.id/ceknik/cek');
  33. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  34. curl_setopt($ch, CURLOPT_POST, 1);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, "nik=$nik&tokek=$token&submit=Cek+NIK");
  36. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  37.  
  38. $headers = array();
  39. $headers[] = 'Connection: keep-alive';
  40. $headers[] = 'Cache-Control: max-age=0';
  41. $headers[] = 'Origin: https://disdukcapil.tangerangkota.go.id';
  42. $headers[] = 'Upgrade-Insecure-Requests: 1';
  43. $headers[] = 'Content-Type: application/x-www-form-urlencoded';
  44. $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';
  45. $headers[] = 'Sec-Fetch-Dest: document';
  46. $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';
  47. $headers[] = 'Sec-Fetch-Site: same-origin';
  48. $headers[] = 'Sec-Fetch-Mode: navigate';
  49. $headers[] = 'Sec-Fetch-User: ?1';
  50. $headers[] = 'Referer: https://disdukcapil.tangerangkota.go.id/ceknik/cek';
  51. $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';
  52. $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';
  53. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  54.  
  55. $result = curl_exec($ch);
  56. // return $result;
  57. if(inStr($result,'Data tersebut tidak terdaftar di Database Disdukcapil Kota Tangerang')){
  58. return "$nik - Tidak Terdaftar \n";
  59. } else {
  60. return "$nik - Terdaftar \n";
  61. }
  62.  
  63. }
  64. function inStr($s,$as) {
  65. $s=strtoupper($s);
  66. if(!is_array($as)) $as=array($as);
  67. for($i=0;$i<count($as);$i++) if(strpos(($s),strtoupper($as[$i]))!==false) return true;
  68. return false;
  69. }
  70.  
  71. function get_between($string, $start, $end)
  72. {
  73. $string = " ".$string;
  74. $ini = strpos($string,$start);
  75. if ($ini == 0) return "";
  76. $ini += strlen($start);
  77. $len = strpos($string,$end,$ini) - $ini;
  78. return substr($string,$ini,$len);
  79. }
  80.  
  81. $gasken = prosesCheck("MASUKAN NIK");
  82. echo $gasken;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement