HTTP requests and cookies

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
Hello, trying to automate freenom.com registration with http requests, with cookies everything is good,
but in fiddler (when making manual request) i can see such parameter
'token' 40 random strings .

I have never had experience with it, any sources about how to emulate it?
Is it even possible without real browser?

Thank you
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
112
Баллы
43
Have you tried to pick browser cookie with c# code?

Код:
instance.ActiveTab.Navigate("http://google.com/");
instance.ActiveTab.WaitDownloading();
// get cookie by domain
// to do this you must have a variable with name "cookie"
project.Variables["cookie"].Value = instance.GetCookie("google.com", true);
Insert new action Post, open element proprieties, open tab "more" change headers value to user settings, at cookie write {-Variable.cookie-}
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
Yes, @SOS Cartões i have tried this, and this does work to get some cookies but the token is generated at the very end of the process , so if i wanted to get token from browser i had to make 80% of the code on browser not http reqests
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
112
Баллы
43
The token a part of the cookie?
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
112
Баллы
43
Well, sometimes I use regex inside cookie to take specific element...
Cookie:
Код:
lumUserLocale=pt_BR; lumUserSessionId=lCCGc_D8Q1dwhKhlTfsZpPqo8YyhkkBK; lumUserName=LUIS+CARLOS; accessToken=lCCGc_D8Q1dwhKhlTfsZpPqo8YyhkkBK; lumUserLogin="VRPAT#[email protected]"; JSESSIONID=I9L7LIv-dp4REEAcSrAEPhyB
Regex:
Код:
(?<=\ accessToken=).*?(?=;)
Result:
Код:
lCCGc_D8Q1dwhKhlTfsZpPqo8YyhkkBK

So, if the "token" is generated at "end of your process" you will need to .getcookie in the end of process.... some languages make it very hard to take, I have too many dificulty to grab instance from AngularJS v2 websites.
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
I do understand this, but the main question is - do i have to use browser
or is it possible to make this only with http requests
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
526
Благодарностей
112
Баллы
43
You must use browser to generate cookie, you can use http get or http post to do requests.
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
Understood. Thank you
 

Кто просматривает тему: (Всего: 2, Пользователи: 0, Гости: 2)