Untitled
3 years ago in HTML
<!DOCTYPE html>
<html lang="en">
<!-- https://untroubledfeel.htmlpasta.com -->
<head>
<script id="__gaOptOutExtension">window['_gaUserPrefs']={ioo:function(){return !0}}</script>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HTTP POST Relayer</title>
<style>html,body {font-family:sans-serif} p {text-align:justify} .n {display:none} .b {font-size:110%} .c {font-size:120%} .d {font-size:84%}.r {color:crimson} a {text-decoration:none}</style>
<script>
function init(){
var d=document,I='getElementById',w=d[I]('fb'),l,p,u=d[I]('u'),z,t='style',D='display',n='none',b='block',s='substring',i='indexOf';
d[I]('nj')[t][D]=n;
l=unescape(location);
p=1+l[i]('?');
if(p){
l=l[s](p);
u.value=l;
w.innerText='Now contacting...   '+(l[s](0,l.indexOf('?')))+'   ...and sending your query';
w[t][D]=b;
crunch();
}else{
d[I]('intro')[t][D]=b;
d[I]('cruncher')[t][D]=b;
d[I]('l').innerText=location;
z=d[I]('example');
l+='?https://en.wikipedia.org/wiki/Special:Search?search=Sydney'
z.appendChild(d.createTextNode(l));
z.setAttribute('href',l);
d[I]('colo')[t][D]=b;
u.focus()
}
}
function crunch(){
var d=document,i='getElementById',u=d[i]('u').value,f=d[i]('h'),l=d.location,s='substring',I='indexOf',q,h,e,a;
l=l.hostname+l.pathname;
q=u[I](l)+1;
if(q){d[i]('u').value=u[s](q+l.length);crunch();return}
if(u[I]('://')<0)u='https://'+u;
q=u[I]('?')+1;
h=q?u[s](0,q-1):u;
f.action=h;
f.method='post';
for(i=f.childNodes.length-1;i>-1;i--){f.removeChild(f.childNodes[i])}
q=q?u[s](q)+'&':'';
for(e=q[I]('=');e>=0;e=q[I]('=')){
a=q[I]('&');
if(a>e){i=d.createElement('input');i.type='hidden';i.name=q[s](0,e);i.value=q[s](e+1,a);f.appendChild(i)}
q=q[s](a+1)
}
if(f.childNodes.length){f.submit()}else{alert('No query arguments found.\nNothing to be POSTed!')}
}
</script>
</head>
<body onload="init()">
<h1>HTTP POST Relayer</h1>
<p id="intro" class="n"><b><big>Summary</big></b>
<br/>This online utility takes HTTP GET requests - written as a single URL - converts them to HTTP POST requests, and sends them to the needed Web server.
<br/><b><big>What are GET and POST requests?</big></b>
<br/>You can find a fairly clear, rigorous and concise explanation at W3School's <a href="https://www.w3schools.com/tags/ref_httpmethods.asp">HTTP methods GET vs POST</a> in the section <i>Compare GET vs. POST</i>.
<br/><b><big>What's the reason to use HTTP POST Relayer?</big></b>
<br/>The submission of online forms is usually done thru GET requests and URLs, but you can stumble upon POST forms on the web. Their annoyance is that, after a form submission, the landing page's URL <i>has no indication</i> of the generating query. In the case you need to save the query, for later use or for sharing the result with other people, there is no way to do it.
<br/>HTTP POST Relayer makes it possible. It takes a special GET request/URL, reshapes it as a POST request, and sends it to the needed site. The target Web server will be unaware of what happened behind the scenes, and sends you back the correct reply page.
<br/>Thanks to <i>HTTP POST Relayer</i>, normal plain-text links may thus store within themselves all the query arguments used in a POST request and can execute the needed POST request.
<br/><b><big>How to create working / shareable POST links</big></b>
<br/>See the additional section <i>Direct use</i>: normal links are able to contain and manage a POST request on the fly, without the need to open this page and paste manually the URL. These <i>automatic links</i> can be shared, written down in texts and references, or saved as bookmarks in your browser.</p>
<div id="fb" class="n c r" style="font-weight:bold"></div>
<div id="nj">HTTP POST Relayer needs to have JavaScript enabled!</div>
<form id="cruncher" action="javascript:crunch()" class="n">
<div><b class="b">URL</b> <input id="u" type="url" class="b" style="width:730px" placeholder="Paste your URL with POST arguments appended, as http://server/path?postVar1=value1&..." required="required"/> <button class="b" id="submit" type="submit">Send</button></div>
</form>
<form id="h" class="n"></form>
<p id="colo" class="n"><b><big>Direct use</big></b>
<br/>The full URL to be converted can be appended just after the URL of this site!
<br/>Full syntax is: <span id="l"></span> + "?" + server location + path (if needed) + "?" + arguments (postvar1=value1&postVar2=value2&...)
<br/>Example: <span class="d"><a id="example"></a></span>.
<br/>Click on the above link to check and see how it works.
<br/>Normal links can now act as POST requests with their arguments. They can be cited in texts or saved as bookmarks.</p>
</body>
</html>