Code:
#include <Winhttp.au3>
$sUName = "xdhd"
$sPassw = "test123"
$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0")
$hw_connect = _WinHttpConnect($hw_open, "www.darkorbit.com")
$sHTml = _WinHttpSimpleRequest($hw_connect, "GET", "")
$aURL = StringRegExp($sHTml,"<form name=""bgcdw_login_form"" method=""post"" class=""bgcdw_login_form"" action=""(\S+)""", 3)
;_ArrayDisplay($aURL)
MsgBox(0,"", $aURL[0])
$sURL = StringReplace(StringRight($aURL[0], StringLen($aURL[0]) -26), "&","&")
MsgBox(0,"",$sURL)
$hw_connect = _WinHttpConnect($hw_open, "auth3.bpsecure.com", $INTERNET_DEFAULT_HTTPS_PORT)
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", $sURL, Default, "http://www.darkorbit.com", Default, $WINHTTP_FLAG_SECURE)
$post = "username=xdhd&password=test123"
_WinHttpSetOption($h_openRequest, $WINHTTP_OPTION_SECURITY_FLAGS, BitOR($WINHTTP_FLAG_SECURE, $WINHTTP_FLAG_ESCAPE_DISABLE))
_WinHttpSendRequest($h_openRequest, "Content-Type: application/x-www-form-urlencoded", $post)
_WinHttpReceiveResponse($h_openRequest)
If _WinHttpQueryDataAvailable($h_openRequest) Then
$header = _WinHttpQueryHeaders($h_openRequest)
$body = _WinHttpReadData($h_openRequest)
FileDelete("index.html")
FileWrite("index.html", $header&$body)
MsgBox(0,"",$header)
EndIf
$aURL = StringRegExp($header, "Location: http://www.darkorbit.com(\S+)", 3)
$sUrl = $aURL[0]
ConsoleWrite("index.html")
_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
$hw_connect = _WinHttpConnect($hw_open, "www.darkorbit.com")
$h_openRequest = _WinHttpOpenRequest($hw_connect, "GET", $sUrl, Default, "http://www.darkorbit.com")
_WinHttpSendRequest($h_openRequest)
_WinHttpReceiveResponse($h_openRequest)
If _WinHttpQueryDataAvailable($h_openRequest) Then
$header = _WinHttpQueryHeaders($h_openRequest)
$body = _WinHttpReadData($h_openRequest)
FileDelete("index2.html")
FileWrite("index2.html", $header&$body)
MsgBox(0,"",$header)
EndIf
ConsoleWrite("index.html")
_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
$hw_connect = _WinhttpConnect( $hw_open, "de2.darkorbit.bigpoint.com")
$sHTml = _WinHttpSimpleRequest($hw_connect, "GET", "/indexInternal.es?action=internalStart")
FileDelete("index3.html")
FileWrite("index3.html", $sHTml)
ShellExecute("index3.html")
_WinHttpCloseHandle($hw_open)
Func _InetReadWinHttp($sType, $sServerName, $sPath = Default, $sReferrer = Default, $sData = Default, $sHeader = Default, $fGetHeaders = Default, $iMode = Default)
Local $sUserAgent = 'Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0'
Local $hSession = _WinHttpOpen($sUserAgent)
Local $hConnect = _WinHttpConnect($hSession, $sServerName)
Local $vReturn = _WinHttpSimpleRequest($hConnect, $sType, $sPath, $sReferrer, $sData, $sHeader, $fGetHeaders, $iMode)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
Return $vReturn
EndFunc ;==>_InetReadWinHttp