-1

我如何在提琴手核心中获取图片。

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");
            };

我希望这会出现在会话部分的这一部分中。我试图在代码中复制这种效果。

在此处输入图像描述

这段代码取自wiki中的demo code

根据答案修改了代码,这是输出

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...
                }

我正在刷新的网址:

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

4

1 回答 1

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...
}
于 2015-09-16T12:50:53.273 回答