Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- using System.Net;
- using System.Text;
- using UnityEngine;
- public class JavaLogin : MonoBehaviour
- {
- public void run()
- {
- string username = "Storm"; //Username
- string password = "m,{_zwxC|d`"; //Encrypted Password
- string urlParam = "username=" + username + "&password=" + password;
- byte[] postData = Encoding.UTF8.GetBytes(urlParam);
- //int postDataLength = postData.Length;
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://krator.net/LoginUserTest.php");
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
- request.ContentLength = postData.Length;
- using (StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.UTF8))
- {
- writer.Write(postData);
- Debug.Log("Post reached.");
- }
- using (StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream(), Encoding.UTF8))
- {
- while (reader.Peek() >= 0)
- {
- Debug.Log("Web response: " + reader.ReadLine()); // or something...
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement