Jump to content
Sign in to follow this  
DarkManX

Login with WinHTTP

Recommended Posts

DarkManX

Hello,

im trying to create a loginscript for a certain website, but it tells me to turn cookies on. i dont know what to do now.

it would be nice if you could help with this case and maybe add some links to tutorials for this topic. my code:

#include <WinHttp.au3>
global $server = "www.comunio.de"
$hSession = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2")
$hConnect = _WinHttpConnect($hSession, $server)
$sHTML  = _WinHttpSimpleRequest($hConnect, "POST", "login.phtml", $server, "login=MYUSERNAME&pass=MYPASSWORD&action=login&%3E%3E+Login_x=33")
fileWrite("test.html", $sHTML)

The snifer code:

####### ENTERING PAGE PROCEDURE #######################################################################
http://www.comunio.de/

GET / HTTP/1.1
Host: www.comunio.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: _pk_id.1.5cef=350e1c6c4322376c.1327368373.36.1331058779.1331049804.; language=de_DE; phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A7%3A%228773258%22%3B%7D; tiplineup_table=false; PHPSESSID=a38q5vah0urvlt0pl3aga4vchvvt5kro; phpbb2mysql_sid=b18d0cf4ed5782d63f1b2b18d4b189df; c=850a383dffc26b696b30f3fe535f4db175a3c670131e6161b86871f05700e8c6; session_language=de_DE; _pk_cvar.1.5cef=%7B%221%22%3A%5B%22VisitorType%22%2C%22Unknown%22%5D%7D; _pk_ses.1.5cef=*
Cache-Control: max-age=0

HTTP/1.1 200 OK
Date: Tue, 06 Mar 2012 18:33:10 GMT
Server: Apache
X-Powered-By: PHP/5.2.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: language=de_DE; expires=Wed, 07-Mar-2012 18:33:10 GMT; path=/; domain=.comunio.de
Set-Cookie: session_language=de_DE; path=/
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 10551
Keep-Alive: timeout=10, max=1500
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

####### LOGIN PROCEDURE #######################################################################


http://www.comunio.de/login.phtml

POST /login.phtml HTTP/1.1
Host: www.comunio.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://www.comunio.de/
Cookie: _pk_id.1.5cef=350e1c6c4322376c.1327368373.36.1331058790.1331049804.; language=de_DE; phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A7%3A%228773258%22%3B%7D; tiplineup_table=false; PHPSESSID=a38q5vah0urvlt0pl3aga4vchvvt5kro; phpbb2mysql_sid=b18d0cf4ed5782d63f1b2b18d4b189df; c=850a383dffc26b696b30f3fe535f4db175a3c670131e6161b86871f05700e8c6; session_language=de_DE; _pk_cvar.1.5cef=%7B%221%22%3A%5B%22VisitorType%22%2C%22Unknown%22%5D%7D; _pk_ses.1.5cef=*
Content-Type: application/x-www-form-urlencoded
Content-Length: 59
login=MYUSERNAME&pass=MYPASSWORD&action=login&%3E%3E+Login_x=33
HTTP/1.1 302 Found
Date: Tue, 06 Mar 2012 18:35:02 GMT
Server: Apache
X-Powered-By: PHP/5.2.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: language=de_DE; expires=Wed, 07-Mar-2012 18:35:02 GMT; path=/; domain=.comunio.de
Set-Cookie: session_language=de_DE; path=/
Set-Cookie: phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A7%3A%228773258%22%3B%7D; expires=Wed, 06-Mar-2013 18:35:02 GMT; path=/; domain=comunio.de
Set-Cookie: phpbb2mysql_sid=4387cfddae841940c113ad053bb816f2; path=/; domain=comunio.de
Set-Cookie: c=850a383dffc26b696b30f3fe535f4db175a3c670131e6161b86871f05700e8c6; path=/; domain=.comunio.de
Location: team_news.phtml
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=10, max=1500
Connection: Keep-Alive
Content-Type: text/html

Hope you can help me!

Share this post


Link to post
Share on other sites
wakillon

We do not Support forum or site auto-login methods. :oops:

Read Forum Rules.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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  

×