Untitled
unknown
plain_text
3 years ago
1.1 kB
8
Indexable
WWWForm form = new WWWForm();
// Username - this is irrelevent - needed for post request
form.AddField("username", "name");
UnityWebRequest wwwSignin = UnityWebRequest.Post("https://an-school-portal.securityzone.vn/api/v1/pub/register", form);
string jsonData = "";
jsonData = "{\"inviteCode\":\"iTJ7YlW1\",\"Username\":\"Thanh.To\",\"Password\":\"TestPass\"}";
if (jsonData != null)
{
byte[] data = System.Text.Encoding.UTF8.GetBytes(jsonData);
UploadHandlerRaw upHandler = new UploadHandlerRaw(data);
upHandler.contentType = "application/json";
wwwSignin.uploadHandler = upHandler;
}
yield return wwwSignin.Send();
if (wwwSignin.isNetworkError)
{
Debug.Log(wwwSignin.error);
}
else
{
// Show results as text
Debug.Log("Returning:" + wwwSignin.downloadHandler.text);
//JSONObject j = new JSONObject(wwwSignin.downloadHandler.text);
}Editor is loading...