Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "_httpRequest.au3"
- $user = 'test'
- $pass = '123'
- $form = '{"username":"'& $user &'","password":"'& $pass &'"}'
- $request = _httpRequest(2, 'https://web.daily.airpay.vn/core/get_csrf/')
- $cookie = _getCookie()
- $TOKEN = StringRegExp($cookie, 'csrftoken=(.*?);', 1)
- If not @error Then
- $TOKEN = $TOKEN[0]
- Else
- MsgBox(0,'', 'lấy token thất bại')
- Exit
- EndIf
- $request = _httpRequest(2, 'https://web.daily.airpay.vn/core/login/',$form,'','','X-CSRFToken: '& $TOKEN &'|Content-Type: application/json;charset=UTF-8')
- If StringInStr($request, 'error: 0') Then
- _httpRequest_Msgbox(0, 'Thành công', 'Đăng nhập thành công')
- Else
- $error = StringRegExp($request, '"error_message": "(.*?)"', 3)[0]
- _httpRequest_Msgbox(0, 'Thất bại', _Decode($error))
- EndIf
- Func _Decode($string)
- $string = StringReplace($string, "\/", "/")
- If StringLen($string) <= 0 Then Return ""
- Local $proc
- For $String_Count = 1 To StringLen($string)
- $proc = StringMid($string, $String_Count, 2)
- If $proc = '\u' Then
- $proc1 = ChrW('0x' & StringMid($string, $String_Count + 2, 4))
- $string = StringReplace($string, StringMid($string, $String_Count, 6), $proc1)
- EndIf
- Next
- Return $string
- EndFunc ;==>_Decode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement