Advertisement
Guest User

Untitled

a guest
Nov 19th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. <?php
  2.  
  3. function getLoginHeader(){
  4.  
  5.     $fields_string = "";
  6.     $username = "youraltemail";
  7.     $password = "youraltpassword";
  8.  
  9.     $fields = array(
  10.         'username' => urlencode($username),
  11.         'password' => urlencode($password),
  12.         'mod' => urlencode("www"),
  13.         'ssl' => urlencode("0"),
  14.         'dest' => urlencode("community")
  15.     );
  16.  
  17.     foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
  18.     $fields_string = substr($fields_string, 0, -1);
  19.  
  20.     $url = "https://secure.runescape.com/m=weblogin/login.ws";
  21.     $ch = curl_init();
  22.     curl_setopt($ch, CURLOPT_URL, $url);
  23.     curl_setopt($ch, CURLOPT_HEADER, true);
  24.     curl_setopt($ch, CURLOPT_POST, 1);
  25.     curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
  26.     curl_setopt($ch, CURLOPT_REFERER, "https://secure.runescape.com/m=weblogin/login.ws");
  27.     curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  28.         "Host: secure.runescape.com",
  29.         "Content-Type: application/x-www-form-urlencoded",
  30.         "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  31.         "Acept-Encoding: gzip, deflate, br",
  32.         "Accept-Language: en-US,en;q=0.5",
  33.         "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0",
  34.     ));
  35.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  36.     $ret = curl_exec($ch);
  37.     curl_close($ch);
  38.     return $ret;
  39. }
  40.  
  41. $response_headers = getLoginHeader();
  42. $session_index = strpos($response_headers, 'session=');
  43. $session_token = substr($response_headers, $session_index+8, 118);
  44. file_put_contents('/var/www/html/assets/ajax/jagex_session_token.txt', $session_token);
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement