php-使用php处理应用程序/x-www-form-urlencoded POST请求
我正在尝试使用PHP处理php-使用php处理应用程序/x-www-form-urlencoded POST请求,php,json,content-type,urlencode,urldecode,Php,Json,Content Type,Urlencode,Urldecode,我正在尝试使用PHP处理应用程序/x-www-form-urlencodedPOST请求。客户端以以下格式发送请求: POST /index.php User-Agent: Android/4.0 Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip action=Settings&device_id=2112121&app_version=420 服务器的响应必须如下所示: { "
应用程序/x-www-form-urlencoded
POST请求。客户端以以下格式发送请求:
POST /index.php User-Agent: Android/4.0
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
action=Settings&device_id=2112121&app_version=420
服务器的响应必须如下所示:
{
"action": "Settings",
"data": {
"entries": {
"service_enabled": "true"
}
},
"data_format": "json"
}
对服务器端的
index.php
有什么想法吗?试试这个$\u POST=json\u decode(file\u get\u contents(“php://input"(对),代码>向我们展示您迄今为止的尝试,我们将帮助您解决遇到的任何问题。不,我不知道。“数据”
从哪里来?我们应该如何处理设备\u id=211221&app\u version=420
?这既不会生成响应(正如OP建议的分配),也不会在他的示例中发明额外的数据。