Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1.  
  2.  
  3. using System.IO;
  4. using System.Net;
  5. using System.Text;
  6. using UnityEngine;
  7.  
  8. public class JavaLogin : MonoBehaviour
  9. {
  10. public void run()
  11. {
  12. string username = "Storm"; //Username
  13. string password = "m,{_zwxC|d`"; //Encrypted Password
  14. string urlParam = "username=" + username + "&password=" + password;
  15. byte[] postData = Encoding.UTF8.GetBytes(urlParam);
  16. //int postDataLength = postData.Length;
  17. HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://krator.net/LoginUserTest.php");
  18.  
  19. request.Method = "POST";
  20. request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
  21. request.ContentLength = postData.Length;
  22. using (StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.UTF8))
  23. {
  24. writer.Write(postData);
  25. Debug.Log("Post reached.");
  26. }
  27. using (StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream(), Encoding.UTF8))
  28. {
  29. while (reader.Peek() >= 0)
  30. {
  31. Debug.Log("Web response: " + reader.ReadLine()); // or something...
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement