www.text + php + c# issue

I’m testing the WWW class functionality but I’m having problems to retrieve the data from the server. Since posting data is ok, I’ll skip that bit.

On the server side, unityOut.php

    $sql = "SELECT * FROM unity ORDER BY cod_user DESC";        
    $consulta = mysql_query($sql, $conexion);

    while($reg = mysql_fetch_array($consulta)){     	

    	echo $reg["name"];	
    	echo $reg["extra_field"];	


That code connects with DB ok, since I can look for the website and see it on the browser:

Now, on the Unity C# side, I want to retrieve that data:

	public string url = "http://...url.../unityOut.php";  	
	private WWW www;    	

	void OnGUI ( ) {
		if (GUI.Button(new Rect(8*unitW, 5*unitH, 8*unitW, 2*unitH), "Get data")){			

	 IEnumerator getData(){
        www = new WWW(url);
        yield return www;
	    Debug.Log("hello: " + www.text);

I’m ok with parsing whatever it comes, but, at this moment…
All I get for www.text is the html label. Any clues of what am I missing?


I have this same problem, even copying directly over from a working JS code. It must be something in C# that needs to be different because none of these answers on Unity Answers work for me!

My problem, in the end, had nothing to do with coding; all it was is that I was forgetting to refresh a URL so I was always running the old code.
My advice, make sure you have updated all your php files on the server. Also, if you have a public URL string storing the URL to collect/send data, make sure that any changes on the code are happening on the Inspector too.