title: POST data from c# to PHP and echo it
body: <p>I know there are a lot of threads about this, but I have a little bit different question.</p>
  
  <p>My code in c# is this:</p>
  
  <pre><code>            string url = "http://10.0.0.4/CS_PHP/index.php";
  
              byte[] byteArray = Encoding.UTF8.GetBytes("message=This is the message" + "&amp;" + "username=This is the usrname");
  
              HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
              webRequest.Method = "POST";
              webRequest.ContentType = "application/x-www-form-urlencoded";
              webRequest.ContentLength = byteArray.Length;
  
              using (Stream webpageStream = webRequest.GetRequestStream())
              {
                  webpageStream.Write(byteArray, 0, byteArray.Length);
              }
  </code></pre>
  
  <p>And I want to see the $_POST array in php, so I tried using this code:</p>
  
  <pre><code>&lt;?php
  if (isset($_POST))
  {
  var_dump($_POST);
  echo "&lt;html&gt;&lt;br/&gt;&lt;/html&gt;";
  
  print_r($_POST);
  echo "&lt;html&gt;&lt;br/&gt;&lt;/html&gt;";
  
  print($_POST["message"]);
  echo "&lt;html&gt;&lt;br/&gt;&lt;/html&gt;";
  
  $pst = file_get_contents('php://input');
  var_dump($pst);
  echo "&lt;html&gt;&lt;br/&gt;&lt;/html&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>But I always get nothing inside the $_POST array.
  When I try using Microsoft Network Monitor, I see that the $_POST array does get inside it the data:
  <a href="https://i.stack.imgur.com/LgOm5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LgOm5.png" alt="$_POST has the data inside it"></a></p>
  
  <p>And just to be clear what I'm getting on the actual page:
  <a href="https://i.stack.imgur.com/5aNUv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5aNUv.png" alt="enter image description here"></a></p>
  
  <p>I think it's somehow related to when I load the page... Don't know...</p>
  
  <p>Thank you for any kind of help</p>