Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Data pass using POST method - WebRequest object

$
0
0
I want to use POST method to pass data over web server. I want to retrieve data provided by web server in JSON format. I have used following code by referring Unity Manual. void Start () { StartCoroutine (LoadLoginInfo ()); } IEnumerator LoadLoginInfo () { Debug.Log("Load Login Info"); WWWForm form = new WWWForm (); form.AddField ("username", "admin"); form.AddField ("password", "Admin123#"); UnityWebRequest www = UnityWebRequest.Post (url, form); yield return www.Send(); if (www.isError) { Debug.Log (www.error); } else { Debug.Log ("Login Data Retrieved"); } } But after certain amount of wait, I am getting following message in console. ![alt text][1] I have already checked this thing into browser but at their everything working normal. ![alt text][2] So what is the correct way to use POST method using WebRequest object? [1]: /storage/temp/72264-screen-shot-2016-06-16-at-20401-pm.png [2]: /storage/temp/72265-screen-shot-2016-06-16-at-20044-pm.png

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>