Доброго времени суток.
У меня такой вопрос:
Вот функция для сохранения HTML кода страницы
function GetUrl(const URL: String): String;
const
HTTP_PORT = 80;
Header = 'Content-Type: application/x-www-form-urlencoded' + sLineBreak;
var
FSession, FConnect, FRequest: HINTERNET;
FHost, FScript: String;
Ansi: PAnsiChar;
Buff: array [0..1023] of Char;
BytesRead: Cardinal;
begin
Result := '';
FHost := DelHttp(Url);
FScript := Url;
Delete(FScript, 1, Pos(FHost, FScript) + Length(FHost));
FSession := InternetOpen('DMFR',PRE_CONFIG_INTERNET_ACCESS , nil, nil,
INTERNET_FLAG_RELOAD);
if not Assigned(FSession) then Exit;
try
FConnect := InternetConnect(FSession, PChar(FHost), HTTP_PORT, nil,
'HTTP/1.0', INTERNET_SERVICE_HTTP, 0, 0);
if not Assigned(FConnect) then Exit;
try
Ansi := 'text/*';
FRequest := HttpOpenRequest(FConnect, 'GET', PChar(FScript), 'HTTP/1.0',
'', @Ansi, INTERNET_FLAG_RELOAD, 0);
if not Assigned(FConnect) then Exit;
try
if not (HttpAddRequestHeaders(FRequest, Header, Length(Header),
HTTP_ADDREQ_FLAG_REPLACE or
HTTP_ADDREQ_FLAG_ADD)) then Exit;
if not (HttpSendRequest(FRequest, nil, 0, nil, 0)) then Exit;
FillChar(Buff, SizeOf(Buff), 0);
repeat
Result := Result + Buff;
FillChar(Buff, SizeOf(Buff), 0);
InternetReadFile(FRequest, @Buff, SizeOf(Buff), BytesRead);
until BytesRead = 0;
finally
InternetCloseHandle(FRequest);
end;
finally
InternetCloseHandle(FConnect);
end;
finally
InternetCloseHandle(FSession);
end;
end;
Может кто подскажет почему не сохраняется код с таким урлом :
http://www.google.com.ua/#q=fff