Lukas
I would regard this one as good 302 Found HTTP/1.1 302 Found Connection: close Date: Tue, 20 Jul 2010 12:31:08 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 X-Powered-By: UrlRewriter.NET 1.7.0 Location: /pages/default.aspx Set-Cookie: .ASPXANONYMOUS=8CCaRJleywEkAAAAZGY3ZGVlODctNWMxYy00OGMxLWFlNDMtY2M5YjZjNWVlNWZmqKdO1iS0TmeNlfE0ejAILHNC9lY1; expires=Mon, 27-Sep-2010 23:11:08 GMT; path=/; HttpOnly Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 136 because it brings up a valid site. Basically its just sending you to a specific page in the web site. This one 302 Found HTTP/1.0 302 Found Location:http://guide.opendns.com/?url=www.bordercircuits.co.uk Content-type: text/html Content-Length: 0 Connection: close Date: Tue, 20 Jul 2010 12:29:10 GMT Server: OpenDNS Guide is bad because its redirected to OpenDNS which essentially does a search. What I'm doing at the moment is function ValidateURL(const URL: string): boolean; var grab: THTTPSend; sl: TStringList; Cntr: integer; Location: string; AddSlash: string; begin if URL = '' then begin Result := False; Exit; end; sl := TStringList.Create; grab := THTTPSend.Create; grab.Timeout := 600; sl.Text := URL; Result := True; try for Cntr := 0 to sl.Count - 1 do begin if IsURL(sl[Cntr]) then begin if grab.HTTPMethod('GET', sl[Cntr]) then begin if (grab.ResultCode div 100) <> 2 then begin if grab.ResultCode = 302 then begin Location := Copy(grab.Headers.Text, Pos('location:', LowerCase(grab.Headers.Text)) + 9, MaxInt); Location := LowerCase(Copy(Location, 1, Pos(#13, Location) - 1)); if 0 <> Pos('?', Location) then begin if URL[Length(URL)] = '/' then AddSlash := '/' else AddSlash := ''; if LowerCase(URL) = Copy(Location, Pos('?url=', Location) + 5, MaxInt) + AddSlash then begin Result := False; Break; end; end; // have to assume its OK cos I can't do much else end else begin Result := False; Break; end; end; grab.Clear; end else begin Result := False; Break; end; end else begin Result := False; Break; end; end; finally grab.Free; sl.Free; end; end; but I'm not happy that it will cover even most eventualities. Roy Lambert ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ synalist-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/synalist-public
