Jump to content
Sign in to follow this  
TheGeneral

Login through SSL connection with HTTP commands?

Recommended Posts

TheGeneral

#include "WinHTTP.au3"
$headers = "User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)" & @CRLF & "Accept-Language:en-us,en;q=0.5" & @CRLF & "Accept-Encoding:gzip,deflate" & @CRLF & "Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @CRLF & "Keep-Alive:300" & @CRLF & "Connection:keep-alive" & @CRLF & "POSTDATA:login=myemail&password=mypass"
$hw_open = _WinHttpOpen()
$hw_connect = _WinHttpConnect($hw_open, "secure.imdb.com")
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "register-imdb/login","HTTP/1.1","https://secure.imdb.com/register-imdb/login","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
_WinHttpSendRequest($h_openRequest,$headers)
_WinHttpReceiveResponse($h_openRequest)
If _WinHttpQueryDataAvailable($h_openRequest) Then
    $header = _WinHttpQueryHeaders($h_openRequest)
    MsgBox(0, "Header", $header)
EndIf
_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)

I tried that, but it seems that server doesn't allow this type of communication. Could anyone help me?

Share this post


Link to post
Share on other sites
TheGeneral

I tried something new, but it still doesn't work

#include "WinHTTP.au3"
$hw_open = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)")
$hw_connect = _WinHttpConnect($hw_open, "secure.imdb.com")
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "register-imdb/login","HTTP/1.1","https://secure.imdb.com/register-imdb/login","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Language: en-us,en;q=0.5")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Encoding: gzip,deflate")
_WinHttpAddRequestHeaders($h_openRequest,"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($h_openRequest,"Keep-Alive: 300")
_WinHttpAddRequestHeaders($h_openRequest,"Connection: keep-alive")
$post = "login=myusername&password=mypassword"
_WinHttpSendRequest($h_openRequest,$WINHTTP_NO_ADDITIONAL_HEADERS,$post)
_WinHttpReceiveResponse($h_openRequest)
If _WinHttpQueryDataAvailable($h_openRequest) Then
    $header = _WinHttpQueryHeaders($h_openRequest)
    ClipPut($header)
EndIf
_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×