title: post data through httpwebrequest and get it in php
body: <p>I have this php code in server :</p>
  
  <pre><code>foreach($_POST as $pdata)
  echo " *-* ".  $pdata." *-*&lt;br&gt; ";
  </code></pre>
  
  <p>and i am sending post data by httpwebrequest in c# :</p>
  
  <pre><code>            HttpWebRequest httpWebRequest = HttpWebRequest.Create("http://127.0.0.1/22") as HttpWebRequest;
          //Specifing the Method
          httpWebRequest.Method = "POST";
          //Data to Post to the Page, itis key value pairs; separated by "&amp;"
          string data = "Username=username&amp;password=password";
          //Setting the content type, it is required, otherwise it will not work.
          httpWebRequest.ContentType = "application/x-www-form-urlencoded";
          //Getting the request stream and writing the post data
          using (StreamWriter sw = new StreamWriter(httpWebRequest.GetRequestStream()))
          {
              sw.Write(data);
          }
          //Getting the Respose and reading the result.
          HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;
          using (StreamReader sr = new StreamReader(httpWebResponse.GetResponseStream()))
          {
              MessageBox.Show(sr.ReadToEnd());
          }
  </code></pre>
  
  <p>static html codes of php page are shown.
  but nothing of posted value are shown in messagebox .that means no data are posted.
  what is wrong?</p>