function CheckUrl(
url:string):Boolean;
var hSession, hfile: hInternet;
dwindex,dwcodelen :dword;
dwcode:array[1..20] of char;
res : pchar;
begin
Result := FALSE;
if Pos('http://',lowercase(
url)) = 0 then begin
url := 'http://'+
url;
end;
hSession := InternetOpen('InetURL:/1.0', INTERNET_OPEN_TYPE_PRECONFIG,NIL, NIL, 0);
if Assigned(hsession) then begin
hfile := InternetOpenUrl(hsession, PCHAR(
url), NIL, 0, INTERNET_FLAG_RELOAD, 0);
dwIndex := 0;
dwCodeLen := 10;
HttpQueryInfo(hfile, HTTP_QUERY_STATUS_CODE, @dwcode, dwcodeLen, dwIndex);
res := pchar(@dwcode);
Result:= (res ='200') or (res ='302');
if Assigned(hfile) then begin
InternetCloseHandle(hfile);
end;
InternetCloseHandle(hsession);
end;
end;