fiddler 保存请求数据并发送到自己的服务器接口 抓包
1、打开fiddler 按Ctrl+r 打开 fiddler script(或者通过菜单Rules 打开Customize Rules)
2、搜索OnBeforeResponse方法,再方法后面添加如下代码
if (oSession.fullUrl.Contains("https://www.baidu.com")){var xhr = new ActiveXObject('Microsoft.XMLHTTP');
var url = 'http://yousite/notify_url';
//var data = '{"response":"'+ oSession.GetResponseBodyAsString() +'","url":"'+ oSession.url +'","headers":"'+ oSession.oRequest.headers +'","raw":"'+ oSession.GetRequestBodyAsString() +'"}';
//xhr.onreadystatechange = function() {}
//xhr.open('POST', url, true);
//xhr.setRequestHeader("Content-Type", "application/json");
//xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
//xhr.send(data);
var param = {
result: oSession.GetResponseBodyAsString(),
url: oSession.url,
headers: oSession.oRequest.headers,
form: oSession.GetRequestBodyAsString()
};
var par = '';
for (var i in param) {
var _data = escape(param[i]);
par += par ? ("&" + i + "=" + _data) : (i + "=" + _data);
}
xhr.onreadystatechange = function() {}
xhr.open('POST', url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.send(par);
}
3、最后自己再编写一个HTTP接口,接受fiddler post过来的数据即可,你自己写,不行@我
End 同志 开始动手尝试吧!