chemthan Posted December 2, 2011 Share Posted December 2, 2011 (edited) I run code: [/size]#include <Winhttp.au3> Global $HTTP = ObjCreate("winhttp.winhttprequest.5.1") Func _HTTPRequest($HTTP, $Method, $URL, $data = "", $Return = "", $Cookie = "") $HTTP.Open($Method, $URL, False) If $Method = "POST" Then $HTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") If $Cookie <> "" Then $HTTP.SetRequestHeader("Cookie", $Cookie) $HTTP.SetRequestHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8') $HTTP.SetRequestHeader('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6') $HTTP.SetRequestHeader("Referer", "http://m.me.zing.vn/login") $HTTP.SetRequestHeader("Connection", "keep-alive") $HTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") $HTTP.SetRequestHeader("Accept-Language", "en-us,en;q=0.5") $HTTP.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7") $HTTP.SetRequestHeader("Keep-Alive", "115") $HTTP.Send($data) Switch $Return Case 1 Return $HTTP.Responsetext Case 2 Return $HTTP.ResponseBody Case 3 Return $HTTP.Getallresponseheaders & $HTTP.Responsetext Case 4 Return $HTTP.Getallresponseheaders & $HTTP.Responsebody EndSwitch EndFunc ;==>_HTTPRequest $id = "autoit123456" $pw = "123456" $data = _HTTPRequest($HTTP, "POST", "http://sso2.zing.vn/index.php?method=login", "pid=25&u1=http%3A%2F%2Flogin.me.zing.vn%2Flogin%2Fsuccess%3Furl%3Dhttp%3A%2F%2Fme.zing.vn&fp=http%3A%2F%2Flogin.me.zing.vn%2Flogin%2Ffail%3Furl%3Dhttp%3A%2F%2Fme.zing.vn&u=" & $id & "&p=" & $pw, 3)[size=2] I use Charles to get header, and obtain: Header 1: Request: POST /index.php?method=login HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ( .NET CLR 3.5.30729; .NET4.0E) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://login.me.zing.vn/login Host: sso2.zing.vn Content-Length: 148 Expect: 100-continue pid=25&u1=http%3A%2F%2Flogin.me.zing.vn%2Flogin%2Fsuccess&fp=http%3A%2F%2Flogin.me.zing.vn%2Flogin%2Ffail&u=autoit123456&p=123456 Response HTTP/1.1 302 Moved Temporarily Server: nginx/0.8.54 Date: Fri, 02 Dec 2011 01:52:57 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: close X-Powered-By: PHP/5.3.5 Set-Cookie: PHPSESSID=usvnotid27tpa03dl7a10e0qh7; path=/ 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: vngauth=AQEr03kv2E7KjOwHAAAAAH03Oew%3D; expires=Fri, 16-Dec-2011 01:52:57 GMT; path=/; domain=zing.vn; httponly Set-Cookie: acn=contralt; expires=Fri, 16-Dec-2011 01:52:57 GMT; path=/; domain=zing.vn; httponly P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Set-Cookie: uin=o0132943050; expires=Fri, 16-Dec-2011 01:52:57 GMT; path=/; domain=zing.vn; httponly Location: http://login.me.zing.vn/login/success?mess=succ&u=autoit123456 Header 2 : Request: GET /login/success?mess=succ&u=contralt HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ( .NET CLR 3.5.30729; .NET4.0E) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://login.me.zing.vn/login Host: login.me.zing.vn Cookie: vngauth=AQEr03kv2E7KjOwHAAAAAH03Oew%3D; acn=autoit123456; uin=o0132943050 Response: HTTP/1.1 302 Found P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Vary: Accept-Encoding Set-Cookie: ZAUTH=1F018988B74DCD2023C2653A;Path=/;Domain=zing.vn;HttpOnly Set-Cookie: ZMES=cf7567e8f953aeb965cfe6c6368b94971322790778;Path=/;Domain=zing.vn Location: http://me.zing.vn Connection: close Server: Jetty(7.1.6.v20100715) Server: IBM_HTTP_Server/7.0.0.15 Header 3 : Request: GET / HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ( .NET CLR 3.5.30729; .NET4.0E) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: Host: me.zing.vn Cookie: vngauth=AQEr03kv2E7KjOwHAAAAAH03Oew%3D; acn=autoit123456; uin=o0132943050; ZAUTH=1F018988B74DCD2023C2653A; ZMES=cf7567e8f953aeb965cfe6c6368b94971322790778 Response: HTTP/1.1 302 Found Server: unknown Location: http://me.zing.vn/h/ Connection: close Header 4: Request: GET /h/ HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ( .NET CLR 3.5.30729; .NET4.0E) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://login.me.zing.vn/login Host: me.zing.vn Cookie: vngauth=AQEr03kv2E7KjOwHAAAAAH03Oew%3D; acn=autoit123456; uin=o0132943050; ZAUTH=1F018988B74DCD2023C2653A; ZMES=cf7567e8f953aeb965cfe6c6368b94971322790778 Response: HTTP/1.1 302 Moved Temporarily Server: nginx Date: Fri, 02 Dec 2011 01:52:58 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Set-Cookie: isnew=autoit123456; path=/; domain=me.zing.vn location: http://me.zing.vn/wlc Server: VNG-ME-78 X-Server: HOME-ZME Header 5 Request: GET /wlc HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ( .NET CLR 3.5.30729; .NET4.0E) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://login.me.zing.vn/login Host: me.zing.vn Cookie: vngauth=AQEr03kv2E7KjOwHAAAAAH03Oew%3D; acn=autoit; uin=o0132943050; ZAUTH=1F018988B74DCD2023C2653A; ZMES=cf7567e8f953aeb965cfe6c6368b94971322790778 Response: HTTP/1.1 200 OK Server: nginx Date: Fri, 02 Dec 2011 01:52:58 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Vary: Accept-Encoding Server: VNG-ME.238 X-Server: WELCOME-ZME I post data to request header 1, and auto get header 2,3,4,5. Thus, I obtain data from response header 5. But, i want to get response at header 1. Can you help me? Edited December 2, 2011 by chemthan Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now