Recent

Author Topic: lNet - Retrieving string from server  (Read 6057 times)

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
lNet - Retrieving string from server
« on: May 06, 2011, 09:16:10 pm »
Hello people.
I'm using lNet and hoping to achieve this:
I'd like a bar at the top of my (GUI) program that displays a string that has been retrieved from my server such as
"Floody Alpha 1.0 released, download now at <link>!"
So it's like an update bar.
I was hoping to retrieve the string which is raw text in a txt file, such as www.myserver.com/update.txt, and every time you run the software it checks for a change.
The part I can't do is actually retrieving the string.
What I was thinking of doing was connecting to the webserver via TCPComponent and sending the GET command but I'm sure there's a much better way to do this.
Thanks in advance,
- Jishaxe

Edit: It's lNet, not LNet. .-.
« Last Edit: May 06, 2011, 09:19:05 pm by Jishaxe »
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

gvnonor

  • Newbie
  • Posts: 6
Re: lNet - Retrieving string from server
« Reply #1 on: May 06, 2011, 09:33:33 pm »
I know that you wanted an lnet solution, but if you
don't mind adding a dependency(the Synapse library), you can use a single line to get the string.

Code: [Select]
HttpGetText(url, htmlpage);
where url is a string(ex-: www.myserver.com/update.txt) and htmlpage is tstringlist which will contain all the lines in the file, after the call.


« Last Edit: May 06, 2011, 09:41:02 pm by gvnonor »

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Re: lNet - Retrieving string from server
« Reply #2 on: May 06, 2011, 09:39:23 pm »
Hmm, this sounds like a brilliant way. I'll wait for other replies but if I don't get any then I'll do it.
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

fabienwang

  • Sr. Member
  • ****
  • Posts: 449
  • Lazarus is the best
    • My blog
Re: lNet - Retrieving string from server
« Reply #3 on: May 06, 2011, 09:44:22 pm »
lnet (it's a L in lowercase) can do that easily.
Please look at lazpaint sources, i have made an update checker that gets a version from a webpage.
I'm using Arch Linux.
Known for: CPickSniff, OpenGrabby
Contributed to: LazPaint

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: lNet - Retrieving string from server
« Reply #4 on: May 06, 2011, 11:22:35 pm »
Look in lNet/examples/visual/http :)

Just change it so that instead of adding the data to memo it puts it where you need it.

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Re: lNet - Retrieving string from server
« Reply #5 on: May 07, 2011, 10:53:29 am »
Okay, thank you Fabien and Mr. lNet, I will look into both, :)
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

 

TinyPortal © 2005-2018