Solved

Retrive text from http.

Posted on 1998-09-24
6
124 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML text in the body of an email (delphi code) 12 96
Dev Express grid collapse 2 39
CheckListBox usage 3 50
Graphics32 under Delphi 10.1 Berlin 2 36
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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

20 Experts available now in Live!

Get 1:1 Help Now