- Home /
Question by
bubblegumsoldier · Jul 11, 2012 at 10:19 AM ·
wwwfileinternetstreamreader
Get txt out of web?
Hi guys, How can I get the content of [this][1] out of the internet? My error:
C:/Users/MyName/Documents/Homepage/http:/goo-muffin.zzl.org/test.txt
My code:
var fileName = "test.txt"; var string = new List.(); function Start () { var sr = new StreamReader("http://goo-muffin.zzl.org/" + fileName); var fileContents = sr.ReadToEnd(); sr.Close();
var lines = fileContents.Split("\n"[0]);
var i :int;
for (line in lines) {
print (line);
string.Add(line);
// string[i] = line;
// i++;
}
}
Comment
Answer by whydoidoit · Jul 11, 2012 at 10:22 AM
Try using WWW and accessing the text property - bear in mind that this is an async function so you should yield the WWW to make sure it gets the data first.
sry mike.. but I already saw this but don't know how to use it in my script