title: http request POST with javascript using Java/Python?
body: <p>I try to connect to <a href="http://leya2.eu/" rel="nofollow noreferrer">http://leya2.eu/</a>.
  I´ve tried a lot of things... the problem is to run the Script on the Website.
  I do want to do it with Python or Java... last thing i tried was PhatomJS, but i only got the BlazingFast Page like everytime.</p>
  
  <p>The Problem is this script:</p>
  
  <pre><code>var XHR="onload"in new XMLHttpRequest?XMLHttpRequest:XDomainRequest,xhr=new XHR;var ww = $(window).width();xhr.open("GET","/___S___/?rid=CLYVwTkbSONnYzhmsnBo6AhooeCoHsgxayFRarvktEYBIdpcL2aQPVoW7U32QGrh&amp;sid=" + ww +"&amp;d=leya2.eu&amp;tz=1500505915.508",true),xhr.onreadystatechange=function(){if(4==xhr.readyState&amp;&amp;(xhr.status==200)){var t=document.createElement("script");t.type="text/javascript",t.text=xhr.responseText,document.body.appendChild(t)}},xhr.send(null);function wait(){}; setTimeout(wait(),4000);
  </code></pre>
  
  <p>So maybe someone got an idea ?</p>
  
  <p>my standard script is like:</p>
  
  <pre><code>from urllib.request import urlopen
  from urllib.parse import urlencode
  
  url = 'http://evidence-server.com/?s=login'
  response = urlopen(url, urlencode(data).encode("utf-8"))
  content = response.read().decode(response.headers.get_content_charset())
  print(content)
  </code></pre>
  
  <p>This allready was near:</p>
  
  <pre><code>var page = require("webpage").create(),
      url = "http://leya2.eu/";
  
  function onPageReady() {
      var htmlContent = page.evaluate(function () {
          return document.documentElement.outerHTML;
      });
  
      console.log(htmlContent);
  
      phantom.exit();
  }
  page.open(url, function (status) {
      if (status !== 'success') {
          console.log('Unable to load the address!');
          phantom.exit();
      } else {
          window.setTimeout(function () {
              console.log(htmlContent);
              phantom.exit();
          }, 5000); 
      }
  });
  </code></pre>