Advertisement
Guest User

curl login

a guest
Oct 14th, 2017
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. <?php
  2. $user_name = "KULLANICIADIM";
  3. $pass = "ŞİFREM";
  4.  
  5. $c = curl_init();
  6.     curl_setopt($c, CURLOPT_URL, 'https://instagram.com/accounts/login/?force_classic_login');
  7.     curl_setopt($c, CURLOPT_REFERER, 'https://instagram.com/accounts/login/?force_classic_login');
  8.     curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
  9.     curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  10.     curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  11.     curl_setopt($c, CURLOPT_COOKIEFILE, 'cookie.txt');
  12.     curl_setopt($c, CURLOPT_COOKIEJAR, 'cookie.txt'); // cookie txt var mı izinded
  13.     $page = curl_exec($c);
  14.  
  15.     preg_match_all('/<input type="hidden" name="csrfmiddlewaretoken" value="([A-z0-9]{32})"\/>/', $page, $token);
  16.     curl_setopt($c, CURLOPT_URL, 'https://instagram.com/accounts/login/?force_classic_login');
  17.     curl_setopt($c, CURLOPT_REFERER, 'https://instagram.com/accounts/login/?force_classic_login');
  18.     curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  19.     curl_setopt($c, CURLOPT_POST, true);
  20.     curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  21.     curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
  22.     curl_setopt($c, CURLOPT_POSTFIELDS, "csrfmiddlewaretoken=".$token[1][0]."&username=" . $user_name . "&password=". $pass);
  23.     $page = curl_exec($c);
  24.      curl_close($c);
  25. $page = str_replace("<head>","<head>".PHP_EOL."<base href='https://www.instagram.com/'>",$page);
  26.     echo $page;
  27.  
  28.     curl_setopt($c, CURLOPT_URL, 'https://instagram.com/yavuzwasheree/');
  29.     curl_setopt($c, CURLOPT_REFERER, 'https://instagram.com/');
  30.     curl_setopt($c, CURLOPT_HTTPHEADER, array(
  31.         'Accept-Language: en-US,en;q=0.8',
  32.         'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36',
  33.         'Accept: */*',
  34.         'X-Requested-With: XMLHttpRequest',
  35.         'Connection: keep-alive'
  36.         ));
  37.     curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  38.     curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  39.     curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
  40.     $page = curl_exec($c);
  41.     curl_close($c);
  42.     $page = str_replace("<head>","<head>".PHP_EOL."<base href='https://www.instagram.com/'>",$page);
  43.     echo $page;
  44.     //header("Location : http://www.instagram.com");
  45. // script bu bi deneme yapalım
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement