Get line 1 from external file located on internet

How would I go about grabbing line 1 from an external file located on the internet and put it into a fld?

Bought a license last year, figured it’s about time I learn xojo.

untested but more or less what you need:

dim h as new httpsocket dim someVar as string = h.get("http://www.somesite.com/somefile.txt",1000) '..then use split to chop the file into lines based on endofline 'then the first line is in array element 0

dim s as String
dim url as string = "http://www.website.com/text.txt"
dim dl as new HTTPSocket
s = (dl.get (url, 100))
TextField1.Text = DefineEncoding(NthField(s, EndOfLine,1), Encodings.UTF8)

Axel and Jeff, thank you both. Sorry for such novice xojo questions.

On this same topic, if I wanted to limit the amount of characters of the first line. I tried to limit to 10 characters by doing this and removing EndOfLine, but didn’t work:

s = (dl.get (url, 10))

s = (dl.get (url, 10)) - 10 is timeout

dim s as String
dim url as string = "http://www.website.com/text.txt"
dim dl as new HTTPSocket
s = (dl.get (url, 100))
s = DefineEncoding(NthField(s, EndOfLine,1), Encodings.UTF8)
TextField1.Text = Left (s, 10)

Axel, excellent. Thank you sir. I need to find me a good book.