繁体   English   中英

php-使用php处理应用程序/ x-www-form-urlencoded POST请求

[英]php - Handle application/x-www-form-urlencoded POST request using php

我正在尝试使用PHP处理application/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有任何想法吗?

试试这个$_POST = json_decode(file_get_contents("php://input"), true);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM