Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

How to get text from webpage

$
0
0
I've been trying to get text from my php page but whenever I use my code it gives me the error:
UnityException: WWW is not ready downloading yet UnityEngine.WWW.get_text () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UtilsBindings.gen.cs:181) GetTextFile+c__Iterator0.MoveNext () (at Assets/GetTextFile.cs:23) UnityEngine.MonoBehaviour:StartCoroutine(String) GetTextFile:Start() (at Assets/GetTextFile.cs:13)
Here's my code: using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.Events; using System; public class GetTextFile : MonoBehaviour { private string WebsiteWithTextUrl = "https://credmanager-rowanharley.c9.io/FileWithText.php"; public Text webUrlText; // Use this for initialization void Start () { StartCoroutine ("GetText"); } IEnumerator GetText(){ WWW GetTextWWW = new WWW (WebsiteWithTextUrl); GetTextWWW.text; yield return GetTextWWW; if (GetTextWWW.text != null) { Debug.LogError ("Here's the text: " + GetTextWWW.text); webUrlText.text = "Here's the text: " + GetTextWWW.text; Exit(); } else if(GetTextWWW.error != null){ Debug.LogError("Couldn't connect to server. Error: " + GetTextWWW.error); } } } Php Code: Could Someone Please tell me what I'm doing wrong asap! If you need me to explain something more, please mention below.

Viewing all articles
Browse latest Browse all 2891

Trending Articles