Jump to content
hk@kordil.com

Read ASCII file from URL like a file

Recommended Posts

Dear All,


I would like to read this file from this below URL just like reading a local ASCII file.

https://kordil.com/lic/test.txt

I would like point this file and read the content. Could any of you share an easy C++ Builder source code with me please.
Edited by hk@kordil.com

Share this post


Link to post

You need to first copy the file from the web server to your computer (in memory or on disk as you like). For that purpose you need a HTTPS component such as the one in ICS (Internet Component Suite http://wiki.overbyte.be and available from GetIT menu in Delphi IDE), or from Indy (Included in Delphi). Using that component you can download the file and then do whatever you need with it.

 

Share this post


Link to post

If server accept http request without SSL, you could use InternetReadFile() api.

 

This way your executable stay slim.

 

 

//Edit

Header should be in WinInet.

 

4 things you need

 

InternetOpen()

InternetOpenUrl()

InternetReadFile()

InternetCloseHandle()

 

Edited by KodeZwerg
Added more text.

Share this post


Link to post
6 hours ago, KodeZwerg said:

If server accept http request without SSL, you could use InternetReadFile() api.

WinInet supports both HTTP and HTTPS.  InternetReadFile() works just fine with HTTPS resources.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×