SHARE
TWEET

Auto-promo bot PHP side

a guest Jun 14th, 2017 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $group_id         = $_GET['groupId'];
  3. $new_role_set_id  = $_GET['newRoleSetId'];
  4. $target_user_id   = $_GET['targetUserId'];
  5.  
  6.  
  7. $login_user       = 'username=YOURBOTUSERNAME&password=YOURBOTPASSWORD';
  8. $file_path_rs     = 'rs.txt';
  9. $file_path_token  = 'token.txt';
  10. $current_rs       = file_get_contents($file_path_rs);
  11. $current_token    = file_get_contents($file_path_token);
  12.  
  13.  
  14. function getRS()
  15. {
  16.     global $login_user, $file_path_rs;
  17.  
  18.     $get_cookies = curl_init('https://www.roblox.com/newlogin');
  19.     curl_setopt_array($get_cookies,
  20.         array(
  21.             CURLOPT_RETURNTRANSFER => true,
  22.             CURLOPT_HEADER => true,
  23.             CURLOPT_POST => true,
  24.             // CURLOPT_HTTPHEADER => array("Content-Length: " . strlen($login_user)),
  25.             CURLOPT_POSTFIELDS => $login_user
  26.         )
  27.     );
  28.  
  29.     $rs = (preg_match('/(\.ROBLOSECURITY=.*?);/', curl_exec($get_cookies), $matches) ? $matches[1] : '');
  30.     file_put_contents($file_path_rs, $rs, true);
  31.     curl_close($get_cookies);
  32.  
  33.     return $rs;
  34. }
  35.  
  36.  
  37. function changeRank($rs, $token)
  38. {
  39.     global $group_id, $new_role_set_id, $target_user_id, $file_path_token;
  40.    
  41.     $promote_user = curl_init("http://www.roblox.com/groups/api/change-member-rank?groupId=$group_id&newRoleSetId=$new_role_set_id&targetUserId=$target_user_id");
  42.     curl_setopt_array($promote_user,
  43.         array(
  44.             CURLOPT_RETURNTRANSFER => true,
  45.             CURLOPT_POST => true,
  46.             CURLOPT_HEADER => true,
  47.             CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token")
  48.         )
  49.     );
  50.  
  51.     $resp = curl_exec($promote_user);
  52.     $resp_header_size = curl_getinfo($promote_user, CURLINFO_HEADER_SIZE);
  53.     $resp_header = substr($resp, 0, $resp_header_size);
  54.     $resp_body = substr($resp, $resp_header_size);
  55.  
  56.     if (preg_match('/GuestData/', $resp_header)) {
  57.    
  58.         $resp_body = changeRank( getRS(), $token );
  59.     } else if (preg_match('/Token Validation Failed/', $resp_header)) {
  60.  
  61.         $new_token = (preg_match('/X-CSRF-TOKEN: (\S+)/', $resp_header, $matches) ? $matches[1] : '');
  62.         file_put_contents($file_path_token, $new_token, true);
  63.         $resp_body = changeRank( $rs, $new_token );
  64.     }
  65.  
  66.     curl_close($promote_user);
  67.  
  68.     return $resp_body;
  69. }
  70.  
  71.  
  72. echo changeRank($current_rs, $current_token);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top