x


Question about www form.

Hi, I am trying to post the data with the url to my webserver and it's working perfectly. But the problem is getting the response data from the request url. How can I get it in Unity?

Here is my example code which is doing Post method for signing in process and I have no idea of getting the response data from that.

    string url = "http://testWebServer.com/sign_in";
    WWWForm form = new WWWForm();
    form.AddField("email", email);
    form.AddField("password", password);

    // Post the URL to the site and create a download object to get the result.
    WWW www = new WWW(url, form); 
    yield return www;

    if (www.error != null)
    {
        bGamerSignedIn = false;
        print("There was an error signing in your user: " + www.error);
    }
    else
    {
        bGamerSignedIn = true;

        //Wrong 
        //Error Authentication header not found.
        if (www.isDone)
            print((string)www.data);

        print("Gamer Sign In completed");
    }
more ▼

asked May 06 '11 at 07:12 AM

Thet Naing Swe gravatar image

Thet Naing Swe
681 70 73 77

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

www.responseheaders catch all the response data from the POST method.. it's all done now..

more ▼

answered May 06 '11 at 07:43 AM

Thet Naing Swe gravatar image

Thet Naing Swe
681 70 73 77

It's just responsing the header information and still looking for the way to get the responsebody information for this POST method. Any one has done like this before?

May 06 '11 at 08:40 AM Thet Naing Swe

Isn't the response body just www.text? Or www.data?

May 06 '11 at 04:33 PM DaveA

yes... the response body is www.text and I forgot to put the header information and that's why I couldn't get authorised.

May 10 '11 at 10:24 AM Thet Naing Swe
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x65
x36

asked: May 06 '11 at 07:12 AM

Seen: 1373 times

Last Updated: May 06 '11 at 07:12 AM