fidder保存请求和保存响应结果

//代理设置后,手机不能上网的解决方法,还无网的话,手机端安装ssl证书    
if (oSession.host.toLowerCase() == "webserver:8888") 
        {
            oSession.host = "webserver:80";

        }            
 //保存请求url  
 if (oSession.uriContains("/aweme/v2/comment/list/") || oSession.uriContains("/aweme/v1/aweme/post/")){
            var fso;
            var file;
            var curDate = new Date(); 
            fso = new ActiveXObject("Scripting.FileSystemObject");
            //文件保存路径,可自定义
            file = fso.OpenTextFile("D:\\Sessions.txt",8 ,true, true);
            file.writeLine(curDate.toLocaleString());
            file.writeLine("Request url: " + oSession.url);
            file.close();
        }
//保存响应
//过滤无关请求,只关注特定请求
        if (oSession.uriContains("/aweme/v2/comment/list/") || oSession.uriContains("/aweme/v1/aweme/post/"))
        {
            
            oSession.utilDecodeResponse();//消除保存的请求可能存在乱码的情况
            var fso;
            var file;
            var filename = "D:\\Sessions.txt"; 
            fso = new ActiveXObject("Scripting.FileSystemObject");
            //文件保存路径,可自定义
            file = fso.OpenTextFile(filename,8 ,true, true);
            file.writeLine("Response code: " + oSession.responseCode);
            file.writeLine("Response body: " + oSession.GetResponseBodyAsString());
            //file.writeLine("\n");
            file.close();
        }

 

posted on 2019-02-02 16:33  悬剑  阅读(226)  评论(0编辑  收藏  举报

导航