- Home /
Stuck on WWW.text
I'm having trouble in retrieving text from a page using WWW class.
I tried the wiki Server Side HighScores with no results.
This is the url for the data I want to load in a string variable.
"http://www.toyotacoopertiresdesafioextremo.com/game/comunicaciones.asp"
I already could parse it correctly hardcoding the string inside the script, but now I receive the html code of a 404 page error in the "hs_get.text".
Is there any example php page or similar to test the script?
Please note I'm in a different location from the server, running on the editor and I don't receive the crossdomain.xml error I was receiving past days.
I'm pretty lost with this things, so any help is welcome.
Answer by KrisCadle · Nov 10, 2011 at 08:52 PM
Not sure if this will help, but I put a .txt file on a server and call the text with www.text
Here's the code I use...
var url = "http://www.YourServer.com/somefile.txt"; var myText : String;
function Start () {
var guiwww : WWW = new WWW(url); yield guiwww;
myText = guiwww.text; GUI.Box(Rect ((Screen.width / 2) + -200, Screen.height - 620, 400, 100), myText);
}
Something Like that... Now the text is a string and you can do whatever you want with it. There are more complicated ways to do this but this is simple... You can use a php file or some other method to write or modify the txt file...
Your answer
Follow this Question
Related Questions
WWW requests are exponentially slow on large web pages (xml) 1 Answer
Problem with WWW 2 Answers
load file with www on webplayer 1 Answer
Why does accessing www.text blocks the coroutine using WWW class? 1 Answer
How do I load a 60mb text file? 0 Answers