是否可以从浏览器URL发出发布请求 [英] Is it possible to do a post request from browser URL
问题描述
我有一个网站,例如www.myfirstsite.com/myapp.
I have one site e.g. www.myfirstsite.com/myapp .
当我登录该网站时,确实从浏览器中提取了POST身份验证请求.
When I do login in this site I did extract the POST request of authentication from the browser.
只是一个简单的身份验证(身份验证URL不同)过程. 参数中的用户名和密码
Is just a simple authentication (the authentication URL is different) process. and username and password in parameters
用户名= abc_用户
username = abc_user
密码= 123456
password = 123456
,完整的URL为www.anothersite.com/login?username=abc_user&password=123456
当我使用Postman
进行POST请求时,收到了预期的结果.
When I do POST request using Postman
I received expected result.
是否可以通过任何方式(我在URL中输入的任何脚本)从浏览器URL本身发出POST请求,例如进行身份验证的GET请求
Is there any way (any script which I enter in URL) to do POST request from browser URL itself like GET Request to authenticate
推荐答案
在浏览器的URL栏中,键入
In your browser's URL bar, type
javascript:
,然后粘贴以下内容
(function(){document.body.innerHTML='<form method="POST" action="http://www.myfirstsite.com/myapp"><input name="username" value="abc_user"/><input name="password" value="123456"/></form>';document.forms[0].submit()})();
它将在页面中插入具有所需值的表单,然后提交.
It will insert a form with the required values in the page and then submit it.
您必须手动键入javascript:
的原因是,出于安全原因,如果粘贴整个Blob,某些浏览器会删除它.
The reason you have to type the javascript:
manually, is that for security reasons, some browsers will strip it off if you paste the entire blob.
您还可以使用以下内容创建书签并使用.
You can also create a bookmark with the contents below and use that.
javascript:(function(){document.body.innerHTML='<form method="POST" action="http://www.myfirstsite.com/myapp"><input name="username" value="abc_user"/><input name="password" value="123456"/></form>';document.forms[0].submit()})();
这篇关于是否可以从浏览器URL发出发布请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!