我寫的應用程序爲UWP,這在服務器,我沒有得到在$ _ POST 數據請求服務器POST方法這是我的代碼示例UWP發送POST請求
public async void POSTreq()
{
Uri requestUri = new Uri("http://www.test.com");
dynamic dynamicJson = new ExpandoObject();
dynamicJson.username = "[email protected]".ToString();
dynamicJson.password = "123456789";
dynamicJson.action = "REGISTERUSER";
string json = "";
json = Newtonsoft.Json.JsonConvert.SerializeObject(dynamicJson);
var objClint = new System.Net.Http.HttpClient();
System.Net.Http.HttpResponseMessage respon = await objClint.PostAsync(requestUri, new StringContent(json,System.Text.Encoding.UTF8,"application/json"));
}
在服務器端我得到空POST
DEBUG: == post() [Array\n(\n)\n]
DEBUG: == get() [Array\n(\n)\n]
DEBUG: == server() [Array\n(\n [CONTENT_LENGTH] => 55\n [CONTENT_TYPE] => application/json; charset=utf-8\n [HTTP_HOST] => www.taskera.com\n [HTTP_CONNECTION] => Keep-Alive\n [PATH] => /sbin:/usr/sbin:/bin:/usr/bin\n [SERVER_SIGNATURE] => <address>Apache/2.2.15 (CentOS) Server at www.taskera.com Port 80</address>\n\n [SERVER_SOFTWARE] => Apache/2.2.15 (CentOS)\n [SERVER_NAME] => www.taskera.com\n [SERVER_ADDR] => 192.168.1.187\n [SERVER_PORT] => 80\n [REMOTE_ADDR] => 192.168.1.34\n [DOCUMENT_ROOT] => /var/www/html\n [SERVER_ADMIN] => [email protected]\n [SCRIPT_FILENAME] => /var/www/html/index.php\n [REMOTE_PORT] => 50574\n [GATEWAY_INTERFACE] => CGI/1.1\n [SERVER_PROTOCOL] => HTTP/1.1\n [REQUEST_METHOD] => POST\n [QUERY_STRING] => \n [REQUEST_URI] => /\n [SCRIPT_NAME] => /index.php\n [PHP_SELF] => /index.php\n [REQUEST_TIME] => 1487390506\n)\n]
那麼我怎樣才能從uwp以php $ _POST可讀格式發送數據。我不想更改服務器端代碼 –