Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. <?php
  2. $login_user = 'username=cartoon765&password=meme';
  3. $file_path_rs = 'rs.txt';
  4. $file_path_token = 'token.txt';
  5. $current_rs = file_get_contents($file_path_rs);
  6. $current_token = file_get_contents($file_path_token);
  7. $url = "https://www.roblox.com/Trade/inventoryhandler.ashx?filter=0&userid=21208890&page=1&itemsPerPage=14&_=147940";
  8.  
  9. $data_json = array(
  10. 'AgentOfferList' => array([
  11. 'AgentID' => 147940,
  12. 'OfferList' => array([
  13. 'UserAssetID' => '706334419',
  14. ]),
  15. 'OfferRobux' => 0,
  16. ],array(
  17. 'AgentID' => 5026427,
  18. 'OfferList' => array([
  19. 'UserAssetID' => '706333708',
  20. ]),
  21. 'OfferRobux' => 0,
  22. )),
  23.  
  24. );
  25. $datajson = json_encode($data_json);
  26. $data = "cmd=send&TradeJSON=" . urlencode($datajson);
  27.  
  28. // [Function] Get ROBLOSECRUITY
  29. function getRS()
  30. {
  31. global $login_user, $file_path_rs;
  32. $get_cookies = curl_init('https://www.roblox.com/newlogin');
  33. curl_setopt_array($get_cookies,
  34. array(
  35. CURLOPT_RETURNTRANSFER => true,
  36. CURLOPT_HEADER => true,
  37. CURLOPT_POST => true,
  38. CURLOPT_POSTFIELDS => $login_user
  39. //CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6",
  40. //CURLOPT_FOLLOWLOCATION => true,
  41. //CURLOPT_REFERER => "http://www.roblox.com"
  42. )
  43. );
  44. $rs = (preg_match('/(\.ROBLOSECURITY=.*?);/', curl_exec($get_cookies), $matches) ? $matches[1] : '');
  45. file_put_contents($file_path_rs, $rs, true);
  46. curl_close($get_cookies);
  47. return $rs;
  48. }
  49.  
  50.  
  51.  
  52. // [Function] Change User's Group Rank
  53. function SendTrade($rs, $token)
  54. {
  55. global $file_path_token;
  56. global $data;
  57. $promote_user = curl_init("https://www.roblox.com/Trade/tradehandler.ashx");
  58. curl_setopt_array($promote_user,
  59. array(
  60. CURLOPT_RETURNTRANSFER => true,
  61. CURLOPT_POST => true,
  62. CURLOPT_HEADER => true,
  63. CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token", "Content-Type: application/x-www-form-urlencoded; charset=UTF-8"),
  64. CURLOPT_POSTFIELDS => $data,
  65. CURLOPT_RETURNTRANSFER => true,
  66. CURLOPT_POST => true,
  67. CURLOPT_HEADER => true,
  68. CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token"),
  69. CURLOPT_REFERER => "https://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=5026427"
  70. )
  71. );
  72. $resp = curl_exec($promote_user);
  73. $resp_header_size = curl_getinfo($promote_user, CURLINFO_HEADER_SIZE);
  74. $resp_header = substr($resp, 0, $resp_header_size);
  75. $resp_body = substr($resp, $resp_header_size);
  76. if (/*preg_match('/GuestData/', $resp_header)*/false) {//this area is an issue, just call getRS() to keep it up to date
  77. // RS invalid
  78. echo("RS invalid");
  79. // break;
  80. // $resp_body = SendTrade(getRS(), $token);
  81. } else if (preg_match('/Token Validation Failed/', $resp_header)) {
  82. // Token invalid
  83. $new_token = (preg_match('/X-CSRF-TOKEN: (\S+)/', $resp_header, $matches) ? $matches[1] : '');
  84. file_put_contents($file_path_token, $new_token, true);
  85. echo("Token invalid");
  86. $resp_body = SendTrade($rs, $new_token);
  87. // break;
  88. }
  89. curl_close($promote_user);
  90. return $resp_body;
  91. }
  92. // Change user's group rank and echo results
  93. SendTrade(getRS(), $current_token);
  94.  
  95.  
  96. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement