I've taken a simple example of the httpClient as per this answer https://stackoverflow.com/a/19983672
I'm trying to get this working, but on my server side (I'm logging the requests) it's empty.
c#
async public void postTest(string theAddress)
{
HttpClient httpClient = new HttpClient();
MultipartFormDataContent form = new MultipartFormDataContent();
form.Add(new StringContent("abc"), "test");
HttpResponseMessage response = await httpClient.PostAsync(theAddress, form);
response.EnsureSuccessStatusCode();
httpClient.Dispose();
string sd = response.Content.ReadAsStringAsync().Result;
}
And on the server side, I'm logging like this
php
$log='';
$log .= $_SERVER['REQUEST_METHOD']."\n";
$log .= "Request array \n";
$log .= print_r($_REQUEST,true);
$log .= "Post array \n";
$log .= print_r($_POST,true);
$fp= fopen('log.txt', 'a+');
fwrite($fp, $log."\n\n");
fclose($fp);
My log after running the c# app looks like this
GET
Request array
Array
(
)
Post array
Array
(
)