Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global $cookies[1][2]
- $res = getHTTP("https://www.fshare.vn/login?fs_csrf=" & $getCSRF[0] & '&LoginForm%5Bemail%5D=' & URLEncode(BinaryToString($user)) & '&LoginForm%5Bpassword%5D=' & URLEncode(BinaryToString($pword)) & '&LoginForm%5BrememberMe%5D=0&yt0=%C4%90%C4%83ng+nh%E1%BA%ADp', mkCookies(), "https://www.fshare.vn/login", 0, 1, 0)
- Func getHTTP($lnk, $cookie = '', $refer = '', $ignorecookies = 0, $post = 0, $redir = 0)
- Local $method = "GET"
- Local $weblink = StringSplit($lnk, '?')
- ;~ _ArrayDisplay($weblink)
- If $post = 1 Then
- $method = "POST"
- Local $linklink = $weblink[1]
- Local $poststring = $weblink[2]
- Else
- Local $linklink = $lnk
- EndIf
- $OHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
- If $redir = 0 Then
- $OHTTP.Option(6) = False
- EndIf
- $OHTTP.Open($method, $linklink, False)
- $OHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0")
- If StringLen($refer) > 1 Then
- $OHTTP.SetRequestHeader("Referer", $refer)
- EndIf
- If StringLen($cookie) > 1 Then
- $OHTTP.SetRequestHeader("Cookie", $cookie)
- EndIf
- If $post = 1 Then
- $OHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
- $OHTTP.SetRequestHeader("Content-Length", StringLen($poststring))
- $OHTTP.Send($poststring)
- Else
- $OHTTP.Send()
- EndIf
- $OHTTP.WaitForResponse
- Local $HeaderResponses = $OHTTP.GetAllResponseHeaders()
- If $ignorecookies = 0 Then
- ; Handle Cookies
- Local $array = StringRegExp($HeaderResponses, 'Set-Cookie: (.+)\r\n', 3)
- ;$cookies = ''
- For $i = 0 To UBound($array) - 1
- ; Add all cookies to a single string, and then clean it up.
- Local $cook = $array[$i] & ';'
- ; Removing parts we do not use..
- $cook = StringRegExpReplace($cook, "( path| domain| expires)=[^;]+", "")
- $cook = StringRegExpReplace($cook, " HttpOnly", "")
- $cook = StringRegExpReplace($cook, "[;]{2,}", ";")
- Local $cook1 = StringSplit($cook, ";")
- For $k = 1 To $cook1[0]
- If StringInStr($cook1[$k], "=") Then
- Local $cook2 = StringSplit(StringReplace($cook1[$k], " ", ""), "=")
- If $cookies[0][0] == "" Then
- $cookies[0][0] = $cook2[1]
- $cookies[0][1] = $cook2[2]
- Else
- Local $inserted = 0
- For $j = 0 To UBound($cookies) - 1
- If $cook2[1] == $cookies[$j][0] Then
- $cookies[$j][1] = $cook2[2]
- $inserted = 1
- ElseIf ($j == (UBound($cookies) - 1)) And ($inserted == 0) Then
- ReDim $cookies[UBound($cookies) + 1][2]
- $cookies[UBound($cookies) - 1][0] = $cook2[1]
- $cookies[UBound($cookies) - 1][1] = $cook2[2]
- EndIf
- Next
- EndIf
- EndIf
- Next
- Next
- EndIf
- Dim $ret[4]
- If StringInStr($HeaderResponses, "Location:") <> 0 Then
- $ret["0"] = $OHTTP.GetResponseHeader("Location")
- $ret["1"] = 1
- Else
- $ret["0"] = ""
- $ret["1"] = 0
- EndIf
- $ret["2"] = $OHTTP.Responsetext
- $ret["3"] = $OHTTP.GetAllResponseHeaders()
- Return $ret
- ;~ return [0]: location
- ;~ [1]: 1/0
- ;~ [2]: ResponseText
- ;~ [3]: All Header
- EndFunc ;==>getHTTP
- Func mkCookies()
- Local $rt = ""
- Local $j
- For $j = 0 To UBound($cookies) - 1
- $rt = $rt & $cookies[$j][0] & "=" & $cookies[$j][1]
- If $j <> (UBound($cookies) - 1) Then
- $rt = $rt & "; "
- EndIf
- Next
- Return $rt
- EndFunc ;==>mkCookies
Add Comment
Please, Sign In to add comment