title: Sending data from a client to a server by means of a http post
body: <p>I'm trying to send data from the client to the server. The client runs a simple python script that uses the 'request' library. The server side consists of another simple php script using the $_POST.</p>
  
  <p>I need the webpage to update depending on the data that is given through the client program.</p>
  
  <p>Here is the python script:</p>
  
  <pre><code>import requests
  
  url = "http://xxxxxxx.com/php_files/text_data.php"
  
  d = {'test': 'It works!'}
  r = requests.post(url, data = d)
  print r.status_code, r.reason
  print r.text
  </code></pre>
  
  <p>And here is the php code:</p>
  
  <pre><code>&lt;!DOCTYPE = html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;h1&gt;
              &lt;?php
  
                  $txt = $_POST['test'];
                  echo $txt;
              ?&gt;
          &lt;/h1&gt;
      &lt;/head&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I need the php page to display 'It works!' on h1 as this is the value that is being passed.
  But for some reason, it does not display anything</p>
  
  <p>r.text prints the required format with 'It works!' in the &lt; h1 > tags, but the same does not get displayed in the actual website.</p>
  
  <p>I've also tried var_dump($txt). It gives me a NULL value.</p>
  
  <p>Any help would be gladly appreciated.</p>