范围:
我一直在尝试模拟this brazilian site的请求,即使它"工作" (我可以从响应中读取正确的HTML),我没有得到#34; Cookies"回来的时候应该至少有一个。
工具:
我正在使用Fiddler2和Chrome的网络标签来监控请求,并且他们都显示没有" Cookies"在回复中返回,但是" next"请求我的浏览器问题,对于" IFrame",显然有一个我无法找到的令牌。
请求一:
GET http://www8.receita.fazenda.gov.br/SIMPLESNACIONAL/aplicacoes.aspx?id=21 HTTP/1.1
Host: www8.receita.fazenda.gov.br
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2
响应中不包含Cookie:This response did not set any cookies.
This response did not contain a P3P Header.
请求二:
GET http://www8.receita.fazenda.gov.br/SimplesNacional/Aplicacoes/ATBHE/ConsultaOptantes.app/ConsultarOpcao.aspx HTTP/1.1
Host: www8.receita.fazenda.gov.br
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
Referer: http://www8.receita.fazenda.gov.br/SIMPLESNACIONAL/aplicacoes.aspx?id=21
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2
Cookie: captcha_token=45820053240202342489914224018480902362433837860225213
这是什么" captcha_token"参数来自?
我尝试了什么:
1 - 手动设置此Cookie。响应仍然没有cookie
2 - 阅读在"页面加载"上执行的任何JavaScript代码第一个请求,但我找不到任何为下一个请求设置cookie的代码
代码示例: