Показать сообщение отдельно

  #9  
Старый 21.09.2008, 03:23
ArxWolf
Познающий
Регистрация: 29.02.2008
Сообщений: 35
Провел на форуме:
36950

Репутация: 54
По умолчанию

Archangelus

В Indy не вижу смысла.
Юзаю такой код:

Код:
function TestUrl(Url: String): Boolean;
var
  hSession, hfile: hInternet;
  dwindex, dwcodelen: dword;
  dwcode: array [1..20] of char;
  res: pchar;
Begin
Try
  if pos('http://', lowercase(Url)) = 0 then
    Url := 'http://'+Url;
  Result := false;
  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
    InternetCloseHandle(hfile);
    InternetCloseHandle(hsession);
  end;
except
Result := false;
end;
end;
ronald добавте в Uses IdSocketHandle;

Последний раз редактировалось ArxWolf; 21.09.2008 в 03:26..
 
Ответить с цитированием