Guest User

Untitled

a guest
Mar 17th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. ignore_user_abort(1);
  4.  
  5. $servername = "localhost";
  6. $username = "rumahfol_AF";
  7. $password = "Iv)APCScGQKb";
  8. $database = "rumahfol_AF";
  9.  
  10. $db = new mysqli($servername, $username, $password, $database);
  11.  
  12. function instagram($ighost, $useragent, $url, $cookie = 0, $data = 0, $httpheader = array(), $proxy = 0, $userpwd = 0, $is_socks5 = 0)
  13. {
  14. $url = $ighost ? 'https://i.instagram.com/api/v1/' . $url : $url;
  15. $ch = curl_init($url);
  16. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  17. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  18. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  19. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  20. curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  21. if($proxy) curl_setopt($ch, CURLOPT_PROXY, $proxy);
  22. if($userpwd) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $userpwd);
  23. if($is_socks5) curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  24. if($httpheader) curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  25. curl_setopt($ch, CURLOPT_HEADER, 1);
  26. if($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  27. if ($data):
  28. curl_setopt($ch, CURLOPT_POST, 1);
  29. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  30. endif;
  31. $response = curl_exec($ch);
  32. $httpcode = curl_getinfo($ch);
  33. if(!$httpcode) return false; else{
  34. $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  35. $body = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  36. curl_close($ch);
  37. return array($header, $body);
  38. }
  39. }
  40.  
  41. function device_id($seed)
  42. {
  43. $volatile_seed = filemtime(__DIR__);
  44. return 'android-'.substr(md5($seed.$volatile_seed), 16);
  45. }
  46.  
  47. function signature($data)
  48. {
  49. $hash = hash_hmac('sha256', $data, '68a04945eb02970e2e8d15266fc256f7295da123e123f44b88f09d594a5902df');
  50. return 'ig_sig_key_version=4&signed_body='.$hash.'.'.urlencode($data);
  51. }
  52.  
  53. function useragent()
  54. {
  55. return 'Instagram 10.8.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)';
  56. }
  57.  
  58. function csrftoken()
  59. {
  60. $fetch = request('si/fetch_headers/', null, null);
  61. $header = $fetch[0];
  62. if (!preg_match('#Set-Cookie: csrftoken=([^;]+)#', $fetch[0], $token)) {
  63. return json_encode(array('result' => false, 'content' => 'Missing csrftoken'));
  64. } else {
  65. return substr($token[0], 22);
  66. }
  67. }
  68.  
  69. function UUID($type)
  70. {
  71. $uuid = sprintf(
  72. '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
  73. mt_rand(0, 0xffff),
  74. mt_rand(0, 0xffff),
  75. mt_rand(0, 0xffff),
  76. mt_rand(0, 0x0fff) | 0x4000,
  77. mt_rand(0, 0x3fff) | 0x8000,
  78. mt_rand(0, 0xffff),
  79. mt_rand(0, 0xffff),
  80. mt_rand(0, 0xffff)
  81. );
  82.  
  83. return $type ? $uuid : str_replace('-', '', $uuid);
  84. }
  85.  
  86. function user_id($username)
  87. {
  88. $user_id = file_get_contents("https://www.instagram.com/$username/?__a=1");
  89. $user_id = json_decode($user_id);
  90. return $user_id->user->id;
  91. }
Add Comment
Please, Sign In to add comment