RT 。网站是这个:
https://eq.wowow.co.jp/CGI/enq/engeki2015/index.cgi/conf/
网站传输用的是multipart/form-data
,不过我用 post 模拟提交的数据和 submit 格式是一样的。
而且看了下两个的 request header 基本上也没差了,但是 respone 的 header 和页面就差了不少。后台没写过不清楚,看了下两个最大的区别应该是一个文档类型是document
一个是xhr
,想问下后台的话可以根据这个直接判定返回的页面吗?
var data={
key:'conf',
mem_flg:'',
page:'1',
back_page:'',
'000021914':'ssd',
'000021912':'男性',
'000021913':'20 代',
'000021911':'徳島県',
'000021916':'sssd',
'000021926':'dsds',
'000021918':'dsdd',
'000021920':'ads',
'000021922':'adsds',
'000021923':'',
'000021924':'0001::同意する',
'000021925':'0001::同意する',
submit:'次 へ '
};
function sendData(data) {
var XHR = new XMLHttpRequest();
var FD = new FormData();
for(name in data) {
FD.append(name, data[name]);
}
XHR.addEventListener('load', function(event) {
console.log('Yeah! Data sent and response loaded.');
});
XHR.addEventListener('error', function(event) {
console.log('Oups! Something goes wrong.');
});
XHR.open('POST', 'https://eq.wowow.co.jp/CGI/enq/engeki2015/index.cgi/conf/');
XHR.setRequestHeader('Upgrade-Insecure-Requests', '1');
XHR.setRequestHeader('Cache-Control','max-age=0');
XHR.send(FD);
}
sendData(data)
POST /CGI/enq/engeki2015/index.cgi/conf/ HTTP/1.1
Host: eq.wowow.co.jp
Connection: keep-alive
Content-Length: 1778
Cache-Control: max-age=0
Origin: https://eq.wowow.co.jp
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary5LSRJwQdceXFo8uo
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
X-FirePHP-Version: 0.0.6
Referer: https://eq.wowow.co.jp/CGI/enq/engeki2015/index.cgi/conf/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: wowow2_MGSID_AuthTicket=57d35173edd644dac7cca0ada9fe586a2b874b7a; wowow2_MGSID=0117130a152e480144668844800011862; enq_plus_000002528=6645110a152e550144677804300003180
HTTP/1.1 200 OK
Date: Fri, 06 Nov 2015 02:48:44 GMT
Server: Apache
Pragma: no-cache
Cache-Control: no-store, no-cache, post-check=0, pre-check=0
Expires: -1
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html;charset=UTF-8
POST /CGI/enq/engeki2015/index.cgi/conf/ HTTP/1.1
Host: eq.wowow.co.jp
Connection: keep-alive
Content-Length: 1754
Origin: https://eq.wowow.co.jp
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryj73JdouNDpXuT6ep
Cache-Control: max-age=0
X-FirePHP-Version: 0.0.6
Accept: */*
Referer: https://eq.wowow.co.jp/CGI/enq/engeki2015/index.cgi/conf/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: wowow2_MGSID_AuthTicket=57d35173edd644dac7cca0ada9fe586a2b874b7a; wowow2_MGSID=0117130a152e480144668844800011862; enq_plus_000002528=6645110a152e550144677804300003180
HTTP/1.1 200 OK
Date: Fri, 06 Nov 2015 02:49:37 GMT
Server: Apache
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html;charset=UTF-8
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.