Guest User

Untitled

a guest
Aug 18th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. $ch = curl_init();
  4. $sTarget = "https://twitter.com/login";
  5. curl_setopt($ch, CURLOPT_URL, $sTarget);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  9. curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
  10. curl_setopt($ch, CURLOPT_COOKIEFILE, "/twitter/cookie.txt");
  11. curl_setopt($ch, CURLOPT_REFERER, "https://twitter.com/login");
  12. $html = curl_exec($ch);
  13.  
  14. preg_match('/<input type="hidden" value="([a-zA-Z0-9]*)" name="authenticity_token"/>/', $html, $match);
  15. $authenticity_token = $match[1];
  16.  
  17. $username = "login";
  18. $password = "pass";
  19.  
  20. # set post data
  21. $sPost = "session[username_or_email]=$username&session[password]=$password&return_to_ssl=true&scribe_log=&redirect_after_login=%2F&authenticity_token=$authenticity_token";
  22.  
  23. $sTarget = "https://twitter.com/sessions";
  24. curl_setopt($ch, CURLOPT_URL, $sTarget);
  25. curl_setopt($ch, CURLOPT_POST, true);
  26. curl_setopt($ch, CURLOPT_POSTFIELDS, $sPost);
  27. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
  29. curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
  30.  
  31. curl_exec($ch);
  32. curl_close($ch);
  33. ?>
Add Comment
Please, Sign In to add comment