我正在向内容中包含 XML 的 php 服务器发送请求:
POST /index3.php HTTP/1.0
Connection: Close
Accept: application/xml
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<root />
我检查了全局变量(如 $_GET
、$_POST
、$_ENV
、$_FILES
, $_REQUEST
...) 但它们都是空的。
如何检索服务器中的内容?
最佳答案
试试这个
$xml = file_get_contents('php://input');
来自 manual :
php://input is a read-only stream that allows you to read raw data from the request body.
关于php - 如何在 PHP 中获取请求内容(正文)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7187631/