Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PlayerIOToken
- {
- public static string SimpleGet(string UsernameOrEmail, string Password) {
- return Get(UsernameOrEmail, Password, "400");
- }
- public static string KongGet(string UserID, string GameAuthToken) {
- return Get(UserID, GameAuthToken, "412");
- }
- public static string FBGet(string AuthToken) {
- return Get("", AuthToken, "418");
- }
- public static string Get(string UsernameOrEmail, string Password, string URI)
- {
- char ESep = '';
- HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://api.playerio.com/api/"+URI);
- req.Proxy = null;
- string request = null;
- if (URI != "418")
- {
- request = (char)0x0A + "&everybody-edits-su9rn58o40itdbnw69plyw" + (char)UsernameOrEmail.Length + UsernameOrEmail + ESep + (char)Password.Length + Password;
- }
- else { request = (char)0x0A + "&everybody-edits-su9rn58o40itdbnw69plyw" + (char)Password.Length + Password; }
- req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded";
- byte[] bytes = Encoding.UTF8.GetBytes(request);
- req.ContentLength = bytes.Length;
- Stream requestStream = req.GetRequestStream();
- requestStream.Write(bytes, 0, bytes.Length);
- WebResponse response = req.GetResponse();
- Stream stream = response.GetResponseStream();
- StreamReader reader = new StreamReader(stream);
- var result = reader.ReadToEnd();
- Token = System.Text.RegularExpressions.Regex.Match(result, @"(?<=\"+(char)0x0A+@")(.*?)(?=\"+(char)0x12+")").Value;
- stream.Dispose();
- reader.Dispose();
- return Token;
- }
- public static string Token;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement