?
Solved

How to retrieve a variable from a webpage ?

Posted on 2005-02-26
3
Medium Priority
?
221 Views
Last Modified: 2010-04-05
Dear Experts!

I need a function, that can retrieve a value from a web page. The purpose of this is to retrieve the external IP address for a machine, querying
a web page, basically, once called, the webpage will return the ip address of the client.

Any idea on how we could do this?

Thank you in advance!

Dave.
0
Comment
Question by:dcrudo
  • 2
3 Comments
 
LVL 5

Expert Comment

by:Greybird
ID: 13411230
Use the IdHTTP component, and its Get method. When you have the page in an AnsiString, it's easy to get the variable you need.
0
 
LVL 5

Accepted Solution

by:
Greybird earned 2000 total points
ID: 13411245
var
  PostDataStream : TStringStream;
  WebPageContent : AnsiString;
begin
  DataStream := TStringStream.Create('');
  try
    IdHTTP1.Get('http://somesite.com', DataStream);
    WebPageContent  := DataStream.DataString;
  finally
    DataStream.Free;
  end;
end;
0
 
LVL 1

Author Comment

by:dcrudo
ID: 13412240
works perfectly!!! Thx a lot!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

621 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