title: Requesting information from one php file to another using only php
body: <p>I am pretty new to php so I'm having trouble with POSTing.
  I am trying to transfer information between 2 php files where send_var.php sends a command by POST and get_var.php executes some data manipulation and returns the response.
  The send_var.php is as follows:</p>
  
  <pre><code>&lt;?php
  $url = "./get_var.php";
  $fields = array('response' =&gt; "323243");
  $data = http_build_query($fields);
  // echo $data."&lt;br /&gt;";
  
  $context = stream_context_create(array(
      'http' =&gt; array(
      'method'  =&gt; 'POST',
      'header'  =&gt; "Content-type: text/html\r\n",
      'content' =&gt; $data
  ),
  ));
  $out = file_get_contents($url, false, $context); 
  echo "Info from get_var : " . $out;
  ?&gt;
  </code></pre>
  
  <p>And the get_var.php is :</p>
  
  <pre><code>&lt;?php
  $arg1 = isset($_POST['response']) ? $_POST['response'] : null;
  if($arg1 == '')
      {
      echo "No Command! ";
      }
  if($arg1 != "")
      {
      echo $_POST['response'];
      }
  else
      {
      $_POST['response'] = "123456";
      echo $_POST['response'] . " end of get_var";
      }
  ?&gt;
  </code></pre>
  
  <p>This code was extracted from other examples on stack overflow. The only output I get is "Info from get_var :"
  Obviously I'm missing some pretty fundamental knowledge. If someone can help it would be much appreciated. I'm executing this under XAMPP.</p>