title: Post method to receive response in php
body: <p>I have to write a php file that was supposed to receive data from a site form with post method . To test it i wrote these two files :</p>
  
  <pre><code>&lt;?php
  
      $url = 'temp.php';
      $data = array('username' =&gt; 'jsafsd@gmail.com', 'password' =&gt; 'lassrd');
      $query=http_build_query($data);
      $options = array(
          'header' =&gt; "Connection: close\r\n".
                              "Content-Length: ".strlen($query)."\r\n",
          'method'  =&gt; 'POST',
          'content' =&gt; $query,
      );
  
  
      $context  = stream_context_create(array ( 'http' =&gt; $options ));
      $result = file_get_contents($url,false,$context);
      var_dump($result);
  
  ?&gt;
  </code></pre>
  
  <p><strong>temp.php</strong></p>
  
  <pre><code>&lt;?php
      if($_POST['username'] &amp;&amp; $_POST['password'])
      echo "hi";
      else 
      echo "bye";
      exit();
  ?&gt;
  </code></pre>
  
  <p>But when i run the first file, all i get is  string</p>
  
  <pre><code>&lt;?php
      if($_POST['username'] &amp;&amp; $_POST['password'])
      echo "hi";
      else 
      echo "bye";
      exit();
  ?&gt;
  </code></pre>
  
  <p>(length=95)</p>
  
  <p>What is the problem with this ?</p>