Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking to see if a Website exists

Status
Not open for further replies.

PaulBaxter

Programmer
Sep 18, 1999
3
GB
I've so far wrote a program to see if your connected to the internet or not. That was easy. But now I need to be able to check if a certain webpage exists. So for example - program loads up if connected check to see if exists. Is there anyway delphi 2 can do this?
 
I'm not sure... I haven't touched delphi 2 in a year... but, if you could find an html viewer component (Maybe Microsoft IE4 for Win3.1 has a COM Interface.... if they used COM back then) You could then parse the results, example: 404 returned would mean that the page definitely does not exist. Sorry If I'm a little vague, but let me know what you think.
 

I'm new to this forum so I'm not sure If i can post URL's in here, but generally, using François Piette's Internet components (freeware), in any version of Delphi, its very simple to peform a 'GET' for that site and check the return code. If its 404 then the page doesn't exist.
If I find i can post the url t ohis compenents here, ill post it and type a small but complete program doing just what you ask.

 
You can post url's, just hit the Preview Post button to see if it is showing alright.

Regards S. van Els
SAvanEls@cq-link.sr
 
Ok, you can get the Internet free components from Once you have done that and installed them, all you have to do is write a small
program like the below.

function TForm1.getdata1:boolean;
begin
TestCli1.URL :' TestCli1.RcvdStream := TFileStream.Create('test.htm', fmCreate);
TestCli1.GetAsync;
end;
procedure TForm1.TestCli1RequestDone(Sender: TObject; RqType: THttpRequest;Error: Word);
begin
TestCli1.RcvdStream.destroy;
if error=404 then
begin
{.......... do something here ......}
end;
end;
end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top