Q:

get data from a server via unity

I'm using unity and I want to receive last build number stored in a online data base 
How I can receive data I searched and find I must use www to do it but I don't know how.
I use to create a WWWForm and add field and add my data to it and then send it to post data to server
Is it possible receive data like wwwform does on send?
Any document about send/receive data via unity will be good also

A:

You can achieve data send/receive functionality thourgh three things in (C# + Unity). Its Co-routine, WWW, WWWForm
Demo of both given below:
For Get Request:
 using UnityEngine;

 public class GetRequestDEmo : MonoBehaviour {

     void Start () {
         string url = "http://exampleWeb.com/myServerScript.php?var1=value2&amp;var2=value2";
         WWW www = new WWW(url);
         StartCoroutine(WaitForRequest(www));
     }

     IEnumerator WaitForRequest(WWW www)
     {
         yield return www;

         // check for errors
         if (www.error == null)
         {
             Debug.Log("WWW Result!: " + www.text);// contains all the data sent from the server
         } else {
             Debug.Log("WWW Error: "+ www.error);
         }    
     }
 }

For Post Request:
public class PostRequestDemo : MonoBehaviour {

     void Start () {

         string url = "http://exampleWeb.com/myServerscript.php";

         WWWForm form = new WWWForm();
         form.AddField("var1", "value1");
         form.AddField("var2", "value2");
         WWW www = new WWW(url, form);

         StartCoroutine(WaitForRequest(www));
     }

     IEnumerator WaitForRequest(WWW www)
     {
         yield return www

         // check for errors
         if (www.error == null)
         {
             Debug.Log("WWW Ok!: " + www.text);// contains all the data sent from the server
         } else {
             Debug.Log("WWW Error: "+ www.error);
         }    
     }    
 }

If you want server side code (in PHP) also then, I will recommend you this Unity Wiki code. Or you can also watch this Video.

