Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getLoginHeader(){
- $fields_string = "";
- $username = "youraltemail";
- $password = "youraltpassword";
- $fields = array(
- 'username' => urlencode($username),
- 'password' => urlencode($password),
- 'mod' => urlencode("www"),
- 'ssl' => urlencode("0"),
- 'dest' => urlencode("community")
- );
- foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
- $fields_string = substr($fields_string, 0, -1);
- $url = "https://secure.runescape.com/m=weblogin/login.ws";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
- curl_setopt($ch, CURLOPT_REFERER, "https://secure.runescape.com/m=weblogin/login.ws");
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- "Host: secure.runescape.com",
- "Content-Type: application/x-www-form-urlencoded",
- "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
- "Acept-Encoding: gzip, deflate, br",
- "Accept-Language: en-US,en;q=0.5",
- "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0",
- ));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $ret = curl_exec($ch);
- curl_close($ch);
- return $ret;
- }
- $response_headers = getLoginHeader();
- $session_index = strpos($response_headers, 'session=');
- $session_token = substr($response_headers, $session_index+8, 118);
- file_put_contents('/var/www/html/assets/ajax/jagex_session_token.txt', $session_token);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement