???????HAR??????
????fiddler?????????HTTP??????????洢??HAR??Http Archive??????????HAR??????JSON????????entries?′洢????????HTTP???????????????????塢????????????????????????????????????????fiddler???????????????????????????????????????????????в?????????????????????????????????????????????????????????????fiddler??????????????????????????????File->Export Sessions->selected sessions????All sessions??
?????????????HTTP ARCHIVE V1.2?????Next??????????????
????????????????????HAR????????????涼????????????Notepad++??????????HAR?????fiddler?У???JSON?????
?????????HAR????淶??ο???http://weizhifeng.net/har-12-spec-chinese-edtion.html??
?????????и?tip?????????HAR??????????????response???????????б??????????????????????”???????“?????????????????????fiddler?????????fiddler?????????????????д?????about:config??????????
???????????????????????????fiddler.importexport.httparchivejson.maxtextbodylength????????????10000?????????????
???????????????fiddler???????HAR??????????HTTP???????????????????????????
???????????tip??????????????HAR?????????????fiddler???????Decode??У????????responseContent?е?????????base64????????????????????????????????????????????Decode???????????????Decode????????????????????е????????????????
????????HAR????????HTTP????洢
??????HAR???????????????????е?HTTP????????洢?????????????????????????????HTTP????????????????HttpInfo?????а????????????У?url??????????GET????POST????????????豸????????塢?????????????POST????????????POST???????????塣??????????????????????????set??get??????
??????ν?HAR?????HTTP????Щ????洢?????????????д?????????????????????????顣?÷???????????????
public List<HttpInfo> HttpInfoSave(){
/*???resources?е?HAR???*/
/*HAR????????У????????String????洢??HttpArchive??????*/
/*???HttpArchive???JSON????*/
for(i = 0??HttpArchive??entry?????){
/*???????HTTP????*/
/*?????????url??????????豸?????????????GET????POST??*/
/*???????????????*/
/*???????????????????*/
/*????POST????????????????????????????*/
}
/*????HttpInfo???б?*/
}
??????????????
?????????????????????????д???????????????????δ???????????????ù????cookie????£???Щ?????????401????????????????????????????ó????????????????????????????????http???????????????????????????https???????????????????????????????md5????????????????????????????????????????????????????????в??????md5?????????????????????????set-cookie??α????????????У???????????????????????????????????????????????????????飺
public void login() throws HttpException?? IOException{
HttpClient client = new HttpClient();
PostMethod post = new PostMethod("login url");
JSONObject js = new JSONObject();
js.element("username"?? "[hzsuixiang01@163.com](mailto:hzsuixiang01@163.com)");
js.element("accountType"?? "0");
js.element("auth"?? "d554e66e583c8946ad81ba52f6ea468d");
post.setRequestBody(js.toString());
int status = client.executeMethod(post);
System.out.println(status+post.getResponseBodyAsString());
Header[] header = post.getResponseHeaders();
cookies[0] = header[6].getValue();       //???????????Set-Cookie??Σ????????????
cookies[1] = header[7].getValue();}
??????????????HTTP????
????????????HAR?????HTTP???????????????????????????????????????Cookie??????????????????????????HAR????е?HTTP????????????????????????????????HTTPClient???????????????????????????????????????????encoding-type?base64?????????????????????base64??????????????????????????????????ж????????????£?
for(int i = 0;i<HttpInfoList.size();i++){
HttpInfo HttpInfo = HttpInfoList.get(i);
if(HttpInfo.getMethod().equals("GET")){
System.out.println("/********************????????"+i+"?????????*******************************/");
HttpClient client = new HttpClient();
GetMethod get = new GetMethod(HttpInfo.getUrl());
get.addRequestHeader("X-User-Agent"??HttpInfo.getUserAgent());
get.addRequestHeader("Cookie"?? cookies[0]);
get.addRequestHeader("Cookie"?? cookies[1]);
int status = client.executeMethod(get);
System.out.println(get.getResponseBodyAsString());
if(HttpInfo.getEncoding().equals("base64")){
byte[] content = Base64.decodeBase64(HttpInfo.getResponseContent());
String contentString = new String(content);
System.out.println(contentString);    }
else{
System.out.println(HttpInfo.getResponseContent());
System.out.println(HttpInfo.getResponseContent().equals(get.getResponseBodyAsString()));
}
}else{
System.out.println("/********************????????"+i+"?????????*******************************/");
MyClient myClient = new MyClient();
if(HttpInfoList.get(i).getMimeType().equals("application/x-[www-form-urlencoded]{
System.out.println("primitive result: "+HttpInfoList.get(i).getResponseContent());
myClient.doPostWithDataPair(HttpInfoList.get(i).getUrl()?? cookies?? HttpInfoList.get(i).getParamsPair());
}
else{
System.out.println("primitive result: "+HttpInfoList.get(i).getResponseContent());
myClient.doPostWithDataJson(HttpInfoList.get(i).getUrl()?? cookies?? HttpInfoList.get(i).getParamsJson());
}
}
}
?????塢DIFF????ж?
??????????е?HTTP?????response???HAR????б???????????response???????ж??y?????????????ж???????????????????????????????????????????