Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi URL checken auf 404 (https://www.delphipraxis.net/64087-url-checken-auf-404-a.html)

Neotracer64 27. Feb 2006 09:52


URL checken auf 404
 
Also ich möchte eine URL checken und gucken ob es sie gibt.
Schön und gut. Ich möchte jetz aber nicht das ganze Video, das 100 MB groß ist downloaden, sondern nur gucken ob der Link nicht down ist.
Wenn 404 kommt weiß ich schonmal, dass der Link down ist. Aber wie breche ich den download des Videos ab während des GETs?
Ich benutze die Indys.

Klaus01 27. Feb 2006 09:58

Re: URL checken auf 404
 
sollte nicht diese Methode TidHTTP das machen
was Du suchst?

procedure Head(URL: string);

Parameters

URL: string

Location of the resource.

Grüße
Klaus

Neotracer64 27. Feb 2006 10:14

Re: URL checken auf 404
 
Danke. Habe durch Head, eine Funktion von marabu in der DP gefunden, die mir weiterhilft.

Zitat:

Zitat von marabu
Delphi-Quellcode:
function UrlCheck(sUrl: String; bAllowRedirects: Boolean = false): Integer;
begin
  with TidHTTP.Create(nil) do
  try
    try
      HandleRedirects := bAllowRedirects;
      Head(sUrl);
      Result := Response.ResponseCode;
    finally
      Free;
    end;
  except
      Result := GetLastError;
  end;
end;

begin
  if UrlCheck('http://www.delphipraxis.net', true) = 200
    then ShowMessage('!')
    else ShowMessage('?');
end;



Alle Zeitangaben in WEZ +1. Es ist jetzt 06:04 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz