Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually enter POST data into browser

I'm debugging my php script and need to try to post data to by manually inputting it into the URL in my browser.

The javascript which sends the request is below. How do I enter the correct data into my browser so it's encoded in the same way as the javascript function? I tried encoding the string with http://meyerweb.com/eric/tools/dencoder/ and putting sendmail.php?q="the encoded string"... but that didn't work. Do I have to add more information?

function SendPHP(str, callback){
    xmlhttp = new XMLHttpRequest();  
    str = "q=" + encodeURIComponent(str);

    xmlhttp.open("POST","sendmail.php", true);
    xmlhttp.onreadystatechange=function(){
        if (xmlhttp.readyState == 4){
                      inProgress=false;
            if(xmlhttp.status == 200){
                            callback(xmlhttp.responseText);
            }
        }
    };
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
        if (inProgress==false){
        inProgress=true;
        xmlhttp.send(str);
        }
        else{
            writeDisplayConsole("ERROR: xmlhttp fired twice!");
        }
}
like image 427
dlofrodloh Avatar asked Feb 22 '26 05:02

dlofrodloh


1 Answers

Use the Chrome Rest plugin extension https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

like image 86
matthijsb Avatar answered Feb 23 '26 19:02

matthijsb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!