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_NO_UI,0);
{Get Validation}
dummy := 0;
bufLen := Length(infoBuffer);
HttpQueryInfo(hfile, HTTP_QUERY_STATUS_CODE, @infoBuffer[0], bufLen, dummy);
result := (infoBuffer ='
200')
or (infoBuffer ='
302');
if result
then
begin
{Get Link}
dummy := 0;
bufLen := Length(infoBuffer2);
HttpQueryInfo(hfile, HTTP_QUERY_LOCATION, @infoBuffer2, bufLen, dummy);
URL := infoBuffer2;
End;
if assigned(hfile)
then InternetCloseHandle(hfile);
InternetCloseHandle(hsession);
end;