I'm trying to POST data to an PHP page using c#.
I tried the MSDN example (I changed the postData to "xml=test") and I tried the example of this post.
The PHP page is very simple. It currently contains:
<?php echo "PostData<br>"; echo "<pre>"; print_r($_POST); echo "</pre>"; ?>
I wrote a simple HTML file for testing. It only contained a form to post data.
<html>
<body>
<form action = "https://myurl/upload/uploadTest.php" method = "post">
<input name = "xml" value="test"><p>
<input type = "submit" value="absenden">
</form>
</body>
</html>
The response of the HTML site is:
PostData
Array
(
[xml] => test
)
This means to me that the connection and the PHP file is ok.
But the response of my c# code is:
OK
PostData<pre>Array
(
)
</pre>
The "OK" comes from "(((HttpWebResponse)response).StatusDescription)" and the rest is "reader.ReadToEnd()".
Can someone tell me why the html file works and the c# not?
And how can I get the c# upload working?