Solved

Retrive text from http.

Posted on 1998-09-24
6
120 Views
Last Modified: 2012-05-04
I need to retrive a single line of text from a file on my web server and load it into a string. I don't want to use the internet components that ship with delphi 4 since they require external files. Can someone give me an example of how this might be done.

Thanks.
0
Comment
Question by:Karma121397
  • 3
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
BlackMan earned 200 total points
Comment Utility
Check Francois Piette's great components at http://www.rtfm.be/fpiette/indexuk.htm. There is a freeware HTTP component with source and a demo. Your best bet is to download the whole ICS file, it seems that the .DPK files are missing if you download only the specific archive...
0
 

Author Comment

by:Karma121397
Comment Utility
I've downloaded the complete set already... I have no clue how to convert the TMemoryStream, which the http component uses, into a string.  Could you give me an exapmle of how to accomplish this? Thanks.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
How about this,,,,

var
  f : TextFile;
 str : string;
begin
  AssignFile(f, 'C:\windows\yourfile.txt');
  Reset(f);
  Readln(f, str);
  ShowMessage(str);
  CloseFile(f);      
end;

Regards,
Viktor Ivanov
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Karma121397
Comment Utility
Is there no way to do it without having to save the stream to a file first?
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
This is not saving. This is reading the string from a text...In order to read the data you need to save it before that, wether you save it yourself you using programming code.

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Is that what you needed? ;->

Regards,
Viktor Ivanov
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now