there is a PHP file with which I try to communicate.
there is a simple HTML like that:
"<form action='feedback.php' method='POST'>blablabl</form>"
now I try to write some C# code to invoke the PHP from a desktop app, which
look like that:
====================
static HttpWebRequest CreateRequest(string url, string method,
IDictionary<string, string> parameters, Stream data)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = method;
foreach (string key in parameters.Keys)
request.Headers.Add(key, parameters[key]);
using (Stream reqStream = request.GetRequestStream())
{
//request.Headers.Add("Content-Length:", reqStream.Length.ToString());
CopyStream(data, reqStream);
}
return request;
}
====================
where URL is the URL of the PHP page.
unfortunately nothin is picked up by the PHP script.
did I miss something?
how do I submit multiple file btw?
Siva M - 24 Apr 2007 06:12 GMT
Try setting the ContentType property of the HttpWebRequest instance to
"application/x-www-form-urlencoded". Also, set the ContentLength to the
actual size of data being written to.
> there is a PHP file with which I try to communicate.
> there is a simple HTML like that:
[quoted text clipped - 26 lines]
> did I miss something?
> how do I submit multiple file btw?
bruce barker - 24 Apr 2007 16:41 GMT
its unlikely that the php page is expecting the parameters as page
headers. its probably expecting a standard browser form post
(content-type=application/x-ww-form-urlencoded). th data is sent as name
value pairs (name=value) with "&" as a seperator. the name and value
should be urlencoded.
if you want to send a file, then the page is expecting a content-type:
multipart/mixed; boundary="myboundrystring". then standard mime headers
with content. (depends on type), delimted by boundary strings
google either mime type for more info.
-- bruce (sqlwork.com)
> there is a PHP file with which I try to communicate.
> there is a simple HTML like that:
[quoted text clipped - 26 lines]
> did I miss something?
> how do I submit multiple file btw?
Lloyd Dupont - 26 Apr 2007 02:53 GMT
thanks bruce

Signature
Regards,
Lloyd Dupont
NovaMind Software
Mind Mapping at its best
www.nova-mind.com
> its unlikely that the php page is expecting the parameters as page
> headers. its probably expecting a standard browser form post
[quoted text clipped - 40 lines]
>> did I miss something?
>> how do I submit multiple file btw?