- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
Код:
function Pars(StartS, Intro, StopS: string): string;
begin
if (Pos(StartS, Intro) <> 0) and (Intro <> '') and (Pos(StopS, Intro) <> 0) then Result := Copy(Intro, Pos(StartS, Intro) + Length(StartS), PosEx(StopS, Intro, Pos(StartS, Intro) + Length(StartS)) - Pos(StartS, Intro) - Length(StartS) - 1) else Result := '';
end;
Код:
procedure TForm1.Button1Click(Sender: TObject);
var HTTP: TIdHTTP;
SSL: TIdSSLIOHandlerSocketOpenSSL;
Page: String;
begin
try HTTP := TidHTTP.Create(nil);
SSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
HTTP.IOHandler := SSL;
try Page := HTTP.Get('https://www.google.ru/');
except end; ShowMessage(Pars(''));
finally FreeAndNil(SSL);
FreeAndNil(HTTP);
Page := '';
end;
end;
function TForm1.Pars(StartS, Intro, StopS: string): string;
begin
if (Pos(StartS, Intro) <> 0) and (Intro <> '') and (Pos(StopS, Intro) <> 0) then Result := Copy(Intro, Pos(StartS, Intro) + Length(StartS), PosEx(StopS, Intro, Pos(StartS, Intro) + Length(StartS)) - Pos(StartS, Intro) - Length(StartS) - 1) else Result := '';
end;