PHP 读取原始发布数据,对于从Flash XmlSocket中获取XML非常有用。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 读取原始发布数据,对于从Flash XmlSocket中获取XML非常有用。相关的知识,希望对你有一定的参考价值。

/**
     Using php://input
     -----------------
     Version: 4.3+
     
     Reading [php://input][1] is the preferred method since PHP 4.3.
     
     The Content-Type header of the posted content must _NOT_ be 
     application/x-www.form-urlencoded or multipart/form-data.
     
     For XML you can use the Content-Type: text/xml.
     
      [1]: http://us2.php.net/manual/en/wrappers.php.php
    */

    // Make sure the user is posting
    if ( $_SERVER['REQUEST_METHOD'] === 'POST' )
    {
        // Read the input from stdin
        $postText = trim(file_get_contents('php://input'));
    }
  
    /**
     Using $HTTP_RAW_POST_DATA
     -------------------------
     Version 3.0+
     
     __Note__: Reading php://input is preferred.
     
     
     As with php://input, the Content-Type header of the 
     posted content must _NOT_ be application/x-www.form-urlencoded or
     multipart/form-data.     
     
     PHP 4.1+
     ~~~~~~~~
     You can also enable [always-populate-raw-post-data][1] in the php.ini to
     have the value always populated reguardless of Content-Type. However
     since this requires config changes it is less portable.
     
      [1]: http://us2.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data
    */
    $postText = $GLOBALS['HTTP_RAW_POST_DATA'];

以上是关于PHP 读取原始发布数据,对于从Flash XmlSocket中获取XML非常有用。的主要内容,如果未能解决你的问题,请参考以下文章

Flash内的搜索框,从本地xml读取数据(actionscript)

我将如何使用 XML 引用 flash 中的帧

使用 curl 和 php 从 url 读取 xml 数据

从 Feedburner RSS 提要中获取原始 XML 数据

使用 Python 串行库处理从串口读取的原始数据?

PHP读取XML并写入数据库