Search Unity

Stream PHP echos back

Discussion in 'Scripting' started by kdarius43, Apr 29, 2019.

  1. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    Hello all,

    I was wondering how to stream back php echos. In my php file i have a loop and inside the loop i have an

    echo("user processed");

    back in unity i would like to display the echo("user processed") as its happening. Right now in my unity script i have

    Code (CSharp):
    1. IEnumerator ProccessUser(){
    2. WWW w = new WWW(urlHost);
    3.  
    4. yield return w;
    5.  
    6. if(w.error != null)
    7.          Debug.Log(w.error);
    8. else
    9.           log.text = w.text.ToString();
    10. }
    11.  
    The issue with this is its waiting for the php to be finished running before i receive the echo. Is there a way to get it every time the echo happens?
     
  2. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    Is this not possible?
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    kukimoto0425 likes this.
  4. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    Oh ok Joe so you are saying it is not possible.
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'm saying check to see if UnityWebRequest has the functionality you want, since I haven't tried it I can't say, but the documentation doesn't say it does not do what you want. WWW that you are using specifically says it does not do what you want, so you're wasting your time with the WWW class.
     
  6. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    170
    oh gotcha.