Показать сообщение отдельно
  #2  
Старый 21.06.2021, 07:22
Katerina1993 Katerina1993 вне форума
Прохожий
 
Регистрация: 22.09.2018
Сообщения: 11
Версия Delphi: Delphi 7
Репутация: 10
По умолчанию

Нашла другой способ с помощью Synapse, но в итоге все равно ничего не происходит. Вот пример кода:
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,httpsend,synacode,SSL_OpenSSL;

type
  TForm1 = class(TForm)
    Button1: TButton;
    sMemo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  function Pars(T_, ForS, _T: string): string;
var
  Form1: TForm1;
  info : string;

implementation

{$R *.dfm}

function Pars(T_, ForS, _T: string): string;
var
a, b: integer;
begin
Result := '';
if (T_ = '') or (ForS = '') or (_T = '') then Exit;
a := Pos(T_, ForS);
if a = 0 then Exit
else a := a + Length(T_);

ForS := Copy(ForS, a, Length(ForS) - a + 1);
b := Pos(_T, ForS);
if b > 0 then Result := Copy(ForS, 1, b - 1);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
HTTP: THTTPSend;
HTML : TStringList;
begin
HTTP:= THTTPSend.Create;
HTML := TStringList.Create;
HTTP.MimeType:='application/x-www-form-urlencoded';
//Например WarFrame :)

if HTTP.HTTPMethod('GET','https://warframe.com/ru') then
begin

HTML.LoadFromStream(HTTP.Document);

info :=Pars('"theme_token":"',Utf8ToAnsi(html.Text),'","'); 
sMemo1.Lines.Add(info);
end;
end;
end.
В чем может быть проблема, не проходит условие if HTTP.HTTPMethod('GET','https://warframe.com/ru') then?
Ответить с цитированием