Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to do a post request from browser URL

I have one site e.g. www.myfirstsite.com/myapp .

When I do login in this site I did extract the POST request of authentication from the browser.

Is just a simple authentication (the authentication URL is different) process. and username and password in parameters

username = abc_user

password = 123456

and the complete URL is www.anothersite.com/login?username=abc_user&password=123456

When I do POST request using Postman I received expected result.

Is there any way (any script which I enter in URL) to do POST request from browser URL itself like GET Request to authenticate

like image 224
NarendraR Avatar asked Feb 08 '17 08:02

NarendraR


1 Answers

In your browser's URL bar, type

javascript:

and then paste the following

(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.

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()})();
like image 169
Robby Cornelissen Avatar answered Nov 10 '22 04:11

Robby Cornelissen