我正在调试我的php脚本,需要尝试通过手动将数据输入到浏览器中的URL来将数据发布到。
发送请求的javascript如下。如何在浏览器中输入正确的数据,使其以与javascript函数相同的方式进行编码?我试着用编码字符串http://meyerweb.com/eric/tools/dencoder/并放入sendmail.php?q="编码字符串"。。。但那没用。我需要添加更多信息吗?
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!");
}
}
使用Chrome Rest插件扩展https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
您可能需要查看Fiddler-web调试代理。https://stackoverflow.com/questions/tagged/fiddler
Fiddler的一个功能是Composer,它可以让你编辑以前看到的请求,或者从头开始创建一个新的请求。看看这个答案,它处理了一个非常类似的问题:用Fiddler 检查POST请求