L
L
libera2016-01-10 18:50:13
Delphi
libera, 2016-01-10 18:50:13

Post request, where does it generate new data?

<input type="hidden" value="c4a1f3104786b3cb874aa622a344aa0543178e12" name="YII_CSRF_TOKEN">

Here is such a line, how to do it, so that it would take data with value, in it when entering the site, each time a new token.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
libera, 2016-01-10
@libera

var
  loging: TStringList;
  befer :string ;
  name: string;
begin
           befer := idhtp1.Get('http://сайт.ru/');
           name := Pars('<input type="hidden" value="',befer,'" name="YII_CSRF_TOKEN">');
           edt3.Text:=(name);

end;

I tried that but it didn't work, or I'm doing something wrong.

O
ORTOL, 2016-01-16
@ORTOL

Function ... (for a given string type ...)

function GetValue(Str:string):String;
var
 p1,p2:Integer;
begin
 p1:=pos('value="',Str);
 p2:=pos('" name="',Str);
 Result:=Copy(Str,p1+7,(p2-p1)-7);
end;

Usage ...
procedure TForm1.FormCreate(Sender: TObject);
var
 s: String;
begin
 s := '<input type="hidden" value="c4a1f3104786b3cb874aa622a344aa0543178e12" name="YII_CSRF_TOKEN">';
 Form1.Caption:=GetValue(s);
end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question