unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, IdIOHandler, IdIOHandlerSocket, IdSSLOpenSSL, httpsend, ssl_openssl,
OleCtrls, SHDocVw, synacode, synautil, Gauges, ExtCtrls, ComCtrls, Grids, DateUtils,
sSkinManager;
type
TForm1 =
class
(TForm)
btn1: TButton;
lbl1: TLabel;
edt2: TEdit;
mmo1: TMemo;
mmo2: TMemo;
lbl2: TLabel;
procedure
btn1Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
function
FoundLocationStrNum(Headers: TStringlist):
integer
;
var
FoundStrPos, i:
integer
;
begin
Result := -
1
;
for
i :=
0
to
Headers
.
Count
do
begin
FoundStrPos := Pos(
'Location: '
, Headers
.
Strings[i]);
if
FoundStrPos >
0
then
begin
Result := i;
exit;
end
;
end
;
end
;
function
GetHTTPStr(http: THTTPSend):
string
;
var
BodyStream: TStringStream;
BodyS: TStringList;
begin
try
BodyS := TStringList
.
Create;
BodyStream := TStringStream
.
Create(result);
begin
BodyS
.
LoadFromStream(http
.
Document);
result := BodyS
.
Text;
end
;
finally
BodyStream
.
Free;
BodyS
.
Free;
end
;
http
.
Document
.
Seek(
0
, soFromBeginning);
end
;
procedure
TForm1
.
btn1Click(Sender: TObject);
label
ERRORLabel;
var
stream: TStringStream;
httpsend: THTTPSend;
Res:
boolean
;
n:
integer
;
KSlink, TOKEN, NewURL:
string
;
A0,A1,A2,A3:
String
;
REZ,z2,QW,result,before,after:
String
;
i,z1,w,t,l:
Integer
;
Cnt:
Integer
;
today : TDateTime;
lol1,GONJO:
string
;
lol2:
Integer
;
znach:
Extended
;
myDate,Date1,myDateX : TDateTime;
m1 :
Integer
;
begin
httpsend:=THTTPSend
.
Create;
httpsend
.
AddPortNumberToHost:=
False
;
Application
.
ProcessMessages;
mmo1
.
Lines
.
LoadFromStream(httpsend
.
Document);
Application
.
ProcessMessages;
stream := TStringStream
.
Create(
''
);
stream
.
WriteString(
'action=isCaptchaNeeded&user=%2B380980561942'
);
Application
.
ProcessMessages;
httpsend
.
Clear;
httpsend
.
MimeType :=
'application/x-www-form-urlencoded'
;
httpsend
.
Document
.
LoadFromStream(stream);
Application
.
ProcessMessages;
stream := TStringStream
.
Create(
''
);
stream
.
WriteString(
'isSubmitted=true&USERNAME=&USER_NAME=&ORIG_URL=&isInetUser=null&buser=&bpath=&user=%2B380980561942&password=435465&captcha=&value%28jumpTo%29=&value%28jumpToUrl%29=&Submit=%D3%E2%B3%E9%F2%E8'
);
Application
.
ProcessMessages;
httpsend
.
Clear;
httpsend
.
MimeType :=
'application/x-www-form-urlencoded'
;
httpsend
.
Document
.
LoadFromStream(stream);
Application
.
ProcessMessages;
result:=IntToStr(httpsend
.
ResultCode);
if
result =
'302'
then
begin
lbl2
.
Caption:=
'Good!'
;
Application
.
ProcessMessages;
end
;
if
result <>
'302'
then
begin
lbl2
.
Caption:=
'Bad!'
;
end
;
if
Res
then
case
httpsend
.
ResultCode
of
301
,
302
,
307
:
begin
n := FoundLocationStrNum(httpsend
.
Headers);
if
(n >=
0
)
and
(n <= httpsend
.
Headers
.
count)
then
begin
NewURL := StringReplace(httpsend
.
Headers
.
Strings[n],
'Location: '
,
''
, []);
Application
.
ProcessMessages;
httpsend
.
Clear;
httpsend
.
HTTPMethod(
'GET'
, NewURL);
Application
.
ProcessMessages;
mmo2
.
Lines
.
Text := GetHTTPStr(httpsend);
Application
.
ProcessMessages;
end
;
end
;
end
;
end
;
end
.