HI,

I am sending a simple xml string ( u can see it in the code) to a PHP
script on a server from a C# app. However its not receiving it all .
PHP script dumps everything I send to it back to me. When I send the
data thru a HTML form with the same string I get the correct output.

for instance
string is : <order><product>mens polo</product><price>4.89</
price><size>large</size></order>
HTML output I get: 1Array ( [hiddenbx] => mens polo4.89large )
My app gets 1Array(\n\n\n)

1 is for receiving some data.

Most likely I am not sending the data in the right form. Any help
will be really appreciated.

Thanks
SS

Here's my code

// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create("http://ny4p.org/
survey08/ssave.php") as HttpWebRequest;
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "<order><product>mens polo</
product><price>4.89</price><size>large</size></order>";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "text/xml";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
// Get the request stream.
Stream dataStream = null;
try
{
dataStream = request.GetRequestStream();
}
catch (WebException we)
{
MessageBox.Show(we.ToString(), "Request error");
strStatus = "Request Error";
return bSuccess;
}
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
// Get the response.
WebResponse response = null;
try
{
response = request.GetResponse()as HttpWebResponse;
}
catch (System.Exception we)
{
MessageBox.Show(we.ToString(), "Response error");
strStatus = "Response Error";
return bSuccess;
}
// Display the status.
strStatus = ((HttpWebResponse)response).StatusDescription;
// Get the stream containing content returned by the
server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
MessageBox.Show(responseFromServer);
bSuccess = true;
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();