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");
[blablabla]
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
oS.utilDecodeResponse();
// 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.