2015-09-16 61 views
-1

如何獲取fiddler核心圖片。從fiddler核心獲取圖片

Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) { 
       Console.WriteLine("{0}:HTTP {1} for {2}", oS.id, oS.responseCode, oS.fullUrl); 
       oS. 

       // Uncomment the following two statements to decompress/unchunk the 
       // HTTP response and subsequently modify any HTTP responses to replace 
       // instances of the word "Microsoft" with "Bayden" 
       //oS.utilDecodeResponse(); oS.utilReplaceInResponse("Microsoft", "Bayden"); 
      }; 

我希望這是在會議部分下的這部分。我試圖在代碼中複製這種效果。

enter image description here

這段代碼是從演示代碼在維基獲得

修改基於答案的代碼,這是輸出

Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) { 
       if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/")) 
       { 
        oS.utilDecodeResponse(); 
        Console.WriteLine("writing bytes"); 
        Console.WriteLine(oS.requestBodyBytes); 
        // oS.responseBodyBytes is a byte[] containing the image 

        Bitmap oBMP = new Bitmap(new MemoryStream(oS.responseBodyBytes)); 


        // Now oBMP is an image object which contains the picture... 
       } 

URL我就爽快:

http://baike.baidu.com/link?url=n8LTFN1PKt2Wp_mQul4-2SAFAXQ5BD5hmxu6m7PiC56Ix7htWUtZg7YqMkzBNnmjaYZpbTGS7HG6Mw6Qss2c2qYYjrqQeAyV2lsL1MusvIe

回答

1

你是指「獲取圖片」的具體含義?像這樣?

if ((oS.responseCode == 200) && 
    oS.oResponse.headers.ExistsAndContains("Content-Type", "image/")) 
{ 
    oS.utilDecodeResponse(); 
    // oS.responseBodyBytes is a byte[] containing the image 
    Bitmap oBMP = new Bitmap(new MemoryStream(oS.responseBodyBytes)); 
    // Now oBMP is an image object which contains the picture... 
} 
+0

是的,我想是的。我會試着看看它是否有效。我想提取下面的數據包,如屏幕截圖中所示我得到了 – aceminer

+0

它給了我這樣的錯誤 – aceminer

+0

無效的參數。這是個例外 – aceminer