2 qq 33940725 qq_33940725 于 2016.02.22 16:11 提问

cookie获取,写入webview问题

我要做的是一个自写的登陆界面,post提交然后获取返回的cookie,跳转webview加载的网页,避免重复登陆。
问题就出在网站的cookie上。
如图那样的cookie怎么获取?除了俩个有规则键对值以外,有时候还有无规则的乱码键对值,不好写入webview吧。

1个回答

qq_33940725
qq_33940725   2016.02.22 16:22

补cookie,发不了图片:

第一次post请求头带的:
Cookie: bf9d2fb11626de3ba06439df1849ef02=210879467872859dabd1a44bb464916c14a91f95s%3A173%3A%22aebfb904472039974ade9f264a4d6cf569d9f390a%3A4%3A%7Bi%3A0%3Bs%3A3%3A%22127%22%3Bi%3A1%3Bs%3A4%3A%22test%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba%3A2%3A%7Bs%3A5%3A%22token%22%3Bs%3A32%3A%22810ea1a8722249cc186e3f1f0a5e3d8f%22%3Bs%3A2%3A%22ip%22%3Bs%3A6%3A%22ignore%22%3B%7D%7D%22%3B; 2f03f706d81549350067e8a81f3807b4=3bf2f39c837753092e7a3d86143d019fff501006s%3A173%3A%22c83ff037de590d9e52669c5e4831e6a72d79704da%3A4%3A%7Bi%3A0%3Bs%3A3%3A%22127%22%3Bi%3A1%3Bs%3A4%3A%22test%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba%3A2%3A%7Bs%3A5%3A%22token%22%3Bs%3A32%3A%22810ea1a8722249cc186e3f1f0a5e3d8f%22%3Bs%3A2%3A%22ip%22%3Bs%3A6%3A%22ignore%22%3B%7D%7D%22%3B; YII_CSRF_TOKEN=9be3184e4af5e51be03108b9acf9a7510c464bb5s%3A40%3A%22101e4fd340276db1d5dd438ecffa6c4f048d09de%22%3B; PHPSESSID=slmtu32k97q90ooqki6kr57t64; d281b427c5f91eacab4ca82b555948d2=fa54a8c1244fc60d1af45e53924ffd81439707efN%3B

返回的:
Set-Cookie: PHPSESSID=o792scg513ssp7k45i91uo87f1; path=/; HttpOnly
Set-Cookie: d281b427c5f91eacab4ca82b555948d2=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Set-Cookie: d281b427c5f91eacab4ca82b555948d2=3e408404fdca9fa25f4af5bd01a67b1294f079f5s%3A173%3A%2211e8a6272ef590e5aacb7035d0cb19b314c33295a%3A4%3A%7Bi%3A0%3Bs%3A2%3A%2238%22%3Bi%3A1%3Bs%3A5%3A%22ziyin%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba%3A2%3A%7Bs%3A5%3A%22token%22%3Bs%3A32%3A%2267c3e14260a83c5650d33600ea6f02ee%22%3Bs%3A2%3A%22ip%22%3Bs%3A6%3A%22ignore%22%3B%7D%7D%22%3B; expires=Wed, 23-Mar-2016 06:24:14 GMT; path=/;

然后再一次post的请求头带的:
Cookie: bf9d2fb11626de3ba06439df1849ef02=210879467872859dabd1a44bb464916c14a91f95s%3A173%3A%22aebfb904472039974ade9f264a4d6cf569d9f390a%3A4%3A%7Bi%3A0%3Bs%3A3%3A%22127%22%3Bi%3A1%3Bs%3A4%3A%22test%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba%3A2%3A%7Bs%3A5%3A%22token%22%3Bs%3A32%3A%22810ea1a8722249cc186e3f1f0a5e3d8f%22%3Bs%3A2%3A%22ip%22%3Bs%3A6%3A%22ignore%22%3B%7D%7D%22%3B; 2f03f706d81549350067e8a81f3807b4=3bf2f39c837753092e7a3d86143d019fff501006s%3A173%3A%22c83ff037de590d9e52669c5e4831e6a72d79704da%3A4%3A%7Bi%3A0%3Bs%3A3%3A%22127%22%3Bi%3A1%3Bs%3A4%3A%22test%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba%3A2%3A%7Bs%3A5%3A%22token%22%3Bs%3A32%3A%22810ea1a8722249cc186e3f1f0a5e3d8f%22%3Bs%3A2%3A%22ip%22%3Bs%3A6%3A%22ignore%22%3B%7D%7D%22%3B; YII_CSRF_TOKEN=9be3184e4af5e51be03108b9acf9a7510c464bb5s%3A40%3A%22101e4fd340276db1d5dd438ecffa6c4f048d09de%22%3B; PHPSESSID=o792scg513ssp7k45i91uo87f1; d281b427c5f91eacab4ca82b555948d2=3e408404fdca9fa25f4af5bd01a67b1294f079f5s%3A173%3A%2211e8a6272ef590e5aacb7035d0cb19b314c33295a%3A4%3A%7Bi%3A0%3Bs%3A2%3A%2238%22%3Bi%3A1%3Bs%3A5%3A%22ziyin%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba%3A2%3A%7Bs%3A5%3A%22token%22%3Bs%3A32%3A%2267c3e14260a83c5650d33600ea6f02ee%22%3Bs%3A2%3A%22ip%22%3Bs%3A6%3A%22ignore%22%3B%7D%7D%22%3B

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!