Advertisement
Guest User

Untitled

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