Estoy haciendo un bot que me automatice el login en un web y creo que me esta dando problemas creo que con las cookies.... os pongo un poco la info
Esta es la info que me saca el live http header:
Citar
http://www.marketglory.com/account_login/
POST /account_login/ HTTP/1.1
Host: www.marketglory.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://www.marketglory.com/
Content-Type: application/x-www-form-urlencoded
Content-Length: 120
Cookie: __cfduid=d43181c96a79c6e98ff78fb22812c11161505423004; _ga=GA1.2.845929005.1505423010; _gid=GA1.2.379722860.1505423010; __auc=1fe82af315e8234299c769495e0; __utma=105699615.845929005.1505423010.1506484770.1506526239.53; __utmz=105699615.1506484770.52.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); fbm_417737454961499=base_domain=.marketglory.com; __mgcid=54cee7e896aedefea74929b79eaee694; __utmc=105699615; mgapp_downloaded_app=1; mg_chat=0; ci_session=16rfh8ni4crjm18ojv902juvr5j10064; is_mobile=0; __asc=185b2e6c15ec3f6194cea6ea9f5; __utmb=105699615.7.10.1506526239; __insp_wid=370090747; __insp_slim=1506526420033; __insp_nv=true; __insp_targlpu=aHR0cDovL3d3dy5tYXJrZXRnbG9yeS5jb20vbG9nb2Zm; __insp_targlpt=UGxheSBNYXJrZXRHbG9yeSBvbmxpbmUgc3RyYXRlZ3kgZ2FtZSwgYW4gb25saW5lIGJyb3dzZXIgd2FyIGdhbWUgLSBlbmdsaXNoIGxvZ29mZg%3D%3D; fbsr_417737454961499=f2ApjIhcf-9drbzCq_yACBC5DkH8VlQYMuvMtjNJ-YE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUUMwb3d1bVRldFAyYk5iN0hWQ3Z3UllUY2hYMkhkVHFJY0xRQW5iYnVoekdZbkNVa1p4VFB1YzQwN0xDWm9SUkI3M2FjMkNyTFF0OWQzRDFGdnctS1BLQlllT015M2plQ2tLNjIyaGh5VDZaRDg2d0Nzek9YcDVYSlpnTDdCWjMybFJhVkU0YVBHWnBCdGFSZzhHNFUzUjNteXJjQWdsal9VTURub3gtZXM5aEludm5pTFJjWWRtaUptcmMycmhkLS1WYU1XNXMzRGJwQUVCcDlUX2dJVG9Rcy1ucmpSclFsMGpTVDNjblItRW82dTlkM0dxWkY4cEJoeXctQ2psb2dqUmY0N0ZGYWJUVU84R0tJS1NseVdQVUJ3R3o3V1hONm5hNmNrVWloNFozeGtwOFk2aXVtYmozNE12X0FRQTExYXh6RklFQWQzZVI3LTY5aTE2SUNsYiIsImlzc3VlZF9hdCI6MTUwNjUyNjQxOSwidXNlcl9pZCI6IjEwMTU2MDYxNTI0NTg3ODQxIn0; __insp_norec_sess=true
Connection: keep-alive
Upgrade-Insecure-Requests: 1
token=adfed48b43fa0f74ad4b2a699052f093&action=loginUser&character_name=minombre&character_password=micontraseña&button=OK: undefined
HTTP/1.1 200 OK
Date: Wed, 27 Sep 2017 15:46:09 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Refresh: 0;url=http://www.marketglory.com/account
Set-Cookie: mg_chat=0; expires=Thu, 28-Sep-2017 03:46:08 GMT; Max-Age=43200; path=/; domain=marketglory.com
X-Powered-By: PHP/7.0.23, PleskLin
Vary: Accept-Encoding
Server: cloudflare-nginx
CF-RAY: 3a4f9811b75e4322-MXP
----------------------------------------------------------
POST /account_login/ HTTP/1.1
Host: www.marketglory.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://www.marketglory.com/
Content-Type: application/x-www-form-urlencoded
Content-Length: 120
Cookie: __cfduid=d43181c96a79c6e98ff78fb22812c11161505423004; _ga=GA1.2.845929005.1505423010; _gid=GA1.2.379722860.1505423010; __auc=1fe82af315e8234299c769495e0; __utma=105699615.845929005.1505423010.1506484770.1506526239.53; __utmz=105699615.1506484770.52.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); fbm_417737454961499=base_domain=.marketglory.com; __mgcid=54cee7e896aedefea74929b79eaee694; __utmc=105699615; mgapp_downloaded_app=1; mg_chat=0; ci_session=16rfh8ni4crjm18ojv902juvr5j10064; is_mobile=0; __asc=185b2e6c15ec3f6194cea6ea9f5; __utmb=105699615.7.10.1506526239; __insp_wid=370090747; __insp_slim=1506526420033; __insp_nv=true; __insp_targlpu=aHR0cDovL3d3dy5tYXJrZXRnbG9yeS5jb20vbG9nb2Zm; __insp_targlpt=UGxheSBNYXJrZXRHbG9yeSBvbmxpbmUgc3RyYXRlZ3kgZ2FtZSwgYW4gb25saW5lIGJyb3dzZXIgd2FyIGdhbWUgLSBlbmdsaXNoIGxvZ29mZg%3D%3D; fbsr_417737454961499=f2ApjIhcf-9drbzCq_yACBC5DkH8VlQYMuvMtjNJ-YE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUUMwb3d1bVRldFAyYk5iN0hWQ3Z3UllUY2hYMkhkVHFJY0xRQW5iYnVoekdZbkNVa1p4VFB1YzQwN0xDWm9SUkI3M2FjMkNyTFF0OWQzRDFGdnctS1BLQlllT015M2plQ2tLNjIyaGh5VDZaRDg2d0Nzek9YcDVYSlpnTDdCWjMybFJhVkU0YVBHWnBCdGFSZzhHNFUzUjNteXJjQWdsal9VTURub3gtZXM5aEludm5pTFJjWWRtaUptcmMycmhkLS1WYU1XNXMzRGJwQUVCcDlUX2dJVG9Rcy1ucmpSclFsMGpTVDNjblItRW82dTlkM0dxWkY4cEJoeXctQ2psb2dqUmY0N0ZGYWJUVU84R0tJS1NseVdQVUJ3R3o3V1hONm5hNmNrVWloNFozeGtwOFk2aXVtYmozNE12X0FRQTExYXh6RklFQWQzZVI3LTY5aTE2SUNsYiIsImlzc3VlZF9hdCI6MTUwNjUyNjQxOSwidXNlcl9pZCI6IjEwMTU2MDYxNTI0NTg3ODQxIn0; __insp_norec_sess=true
Connection: keep-alive
Upgrade-Insecure-Requests: 1
token=adfed48b43fa0f74ad4b2a699052f093&action=loginUser&character_name=minombre&character_password=micontraseña&button=OK: undefined
HTTP/1.1 200 OK
Date: Wed, 27 Sep 2017 15:46:09 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Refresh: 0;url=http://www.marketglory.com/account
Set-Cookie: mg_chat=0; expires=Thu, 28-Sep-2017 03:46:08 GMT; Max-Age=43200; path=/; domain=marketglory.com
X-Powered-By: PHP/7.0.23, PleskLin
Vary: Accept-Encoding
Server: cloudflare-nginx
CF-RAY: 3a4f9811b75e4322-MXP
----------------------------------------------------------
Creo que el problema son las cookies... el "token" lo he comprobado y lo he sacado del codigo funete de la web para logearse, simpre sale uno diferente
.
Lo que me extraña muchisimo es que en el post ya directamente el explorador saca unas cookies no se de donde ni de donde leerlas antes de obtener la respuesta
tengo este codigo:
Citar
#include <String.au3>
$sPD = ''
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://www.marketglory.com", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sPD)
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status
;FileWrite("prueba.txt",$oReceived)
$Token = _StringBetween($oReceived,'<input type="hidden" name="token" value="','" />')
$sPD = "token=" & $Token[1] & "&action=loginUser&character_name=miusuariol&character_password=micontraseña&button=OK: undefined"
$oHTTP.Open("POST", "http://www.marketglory.com/account_login/", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sPD)
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status
FileWrite("prueba.txt",$oReceived)
$sPD = ''
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://www.marketglory.com", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sPD)
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status
;FileWrite("prueba.txt",$oReceived)
$Token = _StringBetween($oReceived,'<input type="hidden" name="token" value="','" />')
$sPD = "token=" & $Token[1] & "&action=loginUser&character_name=miusuariol&character_password=micontraseña&button=OK: undefined"
$oHTTP.Open("POST", "http://www.marketglory.com/account_login/", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sPD)
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status
FileWrite("prueba.txt",$oReceived)
En vez de logearse me salta una web de login otra vez....¿alguna apreciacion??? Gracias!!!!!!