Solved

Retrive text from http.

Posted on 1998-09-24
6
130 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
ID: 1340797
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
ID: 1340798
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
ID: 1340799
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

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

Expert Comment

by:viktornet
ID: 1340801
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
ID: 1340802
Is that what you needed? ;->

Regards,
Viktor Ivanov
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi : could not find program, '...exe' 2 195
When I am typing into a TEdit last word repeats 7 148
Delphi 2 69
Firemonkey allowing RTL on android 6 47
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

821 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