@trancexx Thanks for the input again. Tried to put the "https://" before and i'm still getting error 4, dont know why. Is my aproach wrong? I also tried another thing, to login the main google acc website and then go to the website and check if it would work, but still gives me error. To confirm if i could do that i tried first with the youtube, but when i check after connecting to the youtube url i saw that i was not logged. The code i used:
#include "WinHttp.au3"
Global $sRead, $hOpen, $hConnect, $hConnNew, $sActionPage, $sUsername, $sPassword, $sUrl
Global $hConnect2, $hRequest2, $sChunk, $sData
$sUsername = "Email"
$sPassword = "Password"
$sUrl = "https://accounts.google.com"
;$sActionPage = "ServiceLogin?service=ah&passive=true&continue=https%3A%2F%2Fappengine.google.com%2F_ah%2Fconflogin%3Fcontinue%3Dhttps%3A%2F%2Fwww.raterhub.com%2F<mpl=gm&shdf=ChULEgZhaG5hbWUaCVJhdGVyIEh1YgwSAmFoIhThoWkIjshJkJPbt1Ui-tTuWDmknygBMhSVMFKrRs3jzf4xp8WmlV9ZQ5N-cw#identifier"
$sActionPage = "ServiceLogin?passive=1209600&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&followup=https%3A%2F%2Faccounts.google.com%2FManageAccount#identifier"
$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $sUrl)
$sRead = _WinHttpSimpleFormFill($hConnect, _
$sActionPage, "gaia_loginform", _
"name:Email", $sUsername, _
"type:submit", 0)
$hConnNew = $sRead
$sHTM = _WinHttpSimpleFormFill($hConnNew, _
$hOpen, "gaia_loginform", _
"name:Passwd", $sPassword, _
"type:submit", 0)
If @error Then
MsgBox(0, "Error", "Error: " & @error)
Else
ConsoleWrite(@CRLF & $sHTM & @CRLF & @CRLF)
EndIf
$hConnect2 = _WinHttpConnect($hOpen, "youtube.com")
; Specify the reguest
$hRequest2 = _WinHttpOpenRequest($hConnect2)
; Send request
_WinHttpSendRequest($hRequest2)
; Wait for the response
_WinHttpReceiveResponse($hRequest2)
; Check there is data available...
If _WinHttpQueryDataAvailable($hRequest2) Then
; Read
While 1
$sChunk = _WinHttpReadData($hRequest2)
If @error Then ExitLoop
$sData &= $sChunk
WEnd
ConsoleWrite("###########################################################################")
ConsoleWrite(@CRLF & @CRLF & @CRLF & $sData & @CRLF) ; print to console
Else
MsgBox(48, "Error", "Site is experiencing problems.")
EndIf
_WinHttpCloseHandle($hConnect2)
_WinHttpCloseHandle($hRequest2)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hConnNew)
_WinHttpCloseHandle($hOpen)
Exit
@BetaLeaf Thanks. I'm learning a lot. I must confess, for a person who knows nothing of programming it is a challenge. But i will get there.