#include <winhttp.au3>
#include <array.au3>
#include <string.au3>
Global $hOpen = _WinHttpOpen()
$severfshare = 'www.vn-zoom.com'
;$request = _http($severfshare,'login.me.zing.vn')
$request = _http($severfshare,'login.php?do=login', 'vb_login_username=Account&vb_login_password=&x=20&y=20&s=&securitytoken=guest&do=login&vb_login_md5password=e10adc3949ba59abbe56e057f20f883e')
if StringInStr($request, 'thành công') then
c('login success')
Else
MsgBox(0,'','Login fail')
EndIf
;test($request)
_WinHttpCloseHandle($hOpen)
Func _StringRegExp($string, $reg, $flag = 3);
Local $regexp = StringRegExp($string, $reg, $flag)
if UBound($regexp) > 0 then Return $regexp[0]
EndFunc
Func _Http($sServerName, $sObjectName, $sData = '', $sReferer = Default, $sCookie = '', $sFalg = '')
Local $sHeaders, $sVer = 'Get', $ReadData, $rHeader, $sAccept = Default
Local $hConnect = _WinHttpConnect($hOpen, $sServerName)
If $sData <> '' Then
$sVer = 'Post'
$sHeaders = "Content-Type: application/x-www-form-urlencoded"
$sAccept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
EndIf
if $sObjectName = '' then $sHeaders = "Content-Type: text/html;charset=UTF-8"
Local $hRequest = _WinHttpOpenRequest($hConnect, $sVer, $sObjectName, "HTTP/1.1", $sReferer, $sAccept)
if $sFalg = 5 then _WinHttpSetOption($hRequest, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_DISABLE_REDIRECTS)
_WinHttpAddRequestHeaders($hRequest, 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36')
;_WinHttpAddRequestHeaders($hRequest, 'Origin: https://www.fshare.vn')
;_WinHttpAddRequestHeaders($hRequest, 'scheme: https')
;_WinHttpAddRequestHeaders($hRequest, 'url: /login.php')
If $sCookie <> '' Then _WinHttpAddRequestHeaders($hRequest, 'Cookie: ' & $sCookie)
_WinHttpSendRequest($hRequest, $sHeaders, $sData)
_WinHttpReceiveResponse($hRequest)
If _WinHttpQueryDataAvailable($hRequest) Then
While 1
if $sFalg = 4 then ExitLoop
$ReadData &= _winhttpreaddata($hRequest, 1)
If @error Or StringLen($ReadData) = 0 Then ExitLoop
WEnd
EndIf
$rHeader = _WinHttpQueryHeaders($hRequest)
if $sFalg <> 2 then
$Return = $rHeader & $readData
Else
$Return = $readData
EndIf
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
Return $Return
EndFunc ;==>_Http
Func test($Requesthttp)
$file = FileOpen(@DesktopDir&'\testFlowe.html',2+8+128)
FileWrite($file,$Requesthttp)
ShellExecute(@DesktopDir&'\testFlowe.html')
FileClose($file)
EndFunc
Func _URIEncode($sData)
; Prog@ndy
Local $aData = StringSplit(BinaryToString(StringToBinary($sData, 4), 1), "")
Local $nChar
$sData = ""
For $i = 1 To $aData[0]
$nChar = Asc($aData[$i])
Switch $nChar
Case 45, 46, 48 - 57, 65 To 90, 95, 97 To 122, 126
$sData &= $aData[$i]
Case 32
$sData &= "+"
Case Else
$sData &= "%" & Hex($nChar, 2)
EndSwitch
Next
Return $sData
EndFunc
Func C($aData = '')
Return ConsoleWrite($aData & @CRLF)
EndFunc ;==>C
Func StringBetween($s_Text, $s_Start, $s_End, $s_Flag = 0, $s_Default = '')
Local $cut = _StringBetween($s_Text, $s_Start, $s_End)
If @error Then
If $s_Flag = 0 Then
C('error StringBetween')
Return SetError(1, '', '')
Else
Return $s_Default & SetError(1, '', '')
EndIf
EndIf
Return $cut[0]
EndFunc ;==>StringBetween