Amfphp_Core_HttpRequestGatewayFactory::createGateway PHP Method

createGateway() public static method

content type is recovered by looking at the GET parameter contentType. If it isn't set, it looks in the content headers.
public static createGateway ( Amfphp_Core_Config $config = null ) : Amfphp_Core_Gateway
$config Amfphp_Core_Config optional. If null, the gateway will use the default
return Amfphp_Core_Gateway
    public static function createGateway(Amfphp_Core_Config $config = null)
    {
        $contentType = null;
        if (isset($_GET['contentType'])) {
            $contentType = $_GET['contentType'];
        } else {
            if (isset($_SERVER['CONTENT_TYPE'])) {
                $contentType = $_SERVER['CONTENT_TYPE'];
            }
        }
        $rawInputData = self::getRawPostData();
        return new Amfphp_Core_Gateway($_GET, $_POST, $rawInputData, $contentType, $config);
    }

Usage Example

Beispiel #1
0
<?php

/**
 *  This file is part of amfPHP
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this package in the file license.txt.
 * @package Amfphp_Examples
 */
/**
 * a gateway php script like the normal gateway except that it uses example services
 * @author Ariel Sommeria-klein
 */
require_once dirname(__FILE__) . '/../Amfphp/ClassLoader.php';
$config = new Amfphp_Core_Config();
$config->serviceFolderPaths = array(dirname(__FILE__) . "/Services/");
$gateway = Amfphp_Core_HttpRequestGatewayFactory::createGateway($config);
$gateway->service();
$gateway->output();
Amfphp_Core_HttpRequestGatewayFactory