I have a valid JSON, I want to use POST it using Fiddler and it is not working.

2 posts, 0 answers
  1. Forbannet
    Forbannet avatar
    2 posts
    Member since:
    Jun 2017

    Posted 11 Jun 2017 Link to this post

    I have a rule my fiddlerscript that does the following

    if (oSession.utilFindInRequest("mything",false) > 1) {
    .SaveResponseBody("c:\\myjson\\" + oSession.SuggestedFilename);

    It works PERFECTLY well. It saves a the file as TXT, but inside the file it is a JSON, valid JSON. So I use a programm I made in C# that basically reads the files on this folder, and POSTS it to a PHP script I have and this PHP inserts into a mysql database.


    But I would like to make Fiddler inject direct into my website. So I tried some workaround like creating a XMLRequest inside my rule in fiddlerscript


    fb1 = new ActiveXObject("MSXML2.ServerXMLHTTP.3.0");


    And it works (does create the request)

    but my PHP gets the request corrupted (because the json have some # and & and empty stuff etc). The problem is probably with the XMLHTTP3.0.


    So I am trying to have my RESPONSEBODY encoded as base64 or something else, and Eric once posted the following for a different user


    "nstead, keep the bytes as bytes

            // Remove chunking & compression

            // Get raw bytes
            byte[] arrBody = oS.responseBodyBytes;

            // Convert to base64
            string sBase64 = Convert.ToBase64String(arrBody);"


    But I cannot use this line (        byte[] arrBody = oS.responseBodyBytes;  ) it does not compile.

    also when I base64 encode using

    var obytes = System.Text.Encoding.UTF8.GetBytes(oSession.responseBodyBytes);

    var base64 = Convert.ToBase64String(obytes);


    if I log this base64 var to CONSOLE (Fiddler) and then Decode, it works well (Valid JSON) but if I use once again my XMLHTTPREQUEST it corrupts the JSON.
    The problem is with the XMLHTTPREQUEST then, how do I inject a valid JSON from Fiddlerscript to my PHP page? without messing it up because once again, my JSON has symbols like # and a lot of \/ (slashes) that the XMLHTTPREQUEST removes.


  2. Forbannet
    Forbannet avatar
    2 posts
    Member since:
    Jun 2017

    Posted 11 Jun 2017 in reply to Forbannet Link to this post

    I figured out the main issue, this JSON is quite big and also has XML inside it lol. The XML part is messing up
Back to Top