예제 #1
0
<?php

function param_post($a, $b = null)
{
    echo "{$a}, {$b}";
}
function param_get($a, $b = null)
{
    echo "{$a}, {$b}";
}
function param_request($a, $b = null)
{
    echo "{$a}, {$b}";
}
class Param
{
}
param_post(array('post1' => Param::STRING, 'post2' => Param::STRING));
param_get(array('get1' => Param::STRING, 'get2' => Param::STRING));
param_request(array('req1' => Param::STRING, 'req2' => Param::STRING), 'param_');
echo $post_post1;
echo $get_get1;
echo $param_req1;
//ERROR: undefined variable
echo $post_foo;
//ERROR: undefined variable
echo $get_post1;
//ERROR: undefined variable
echo $get_req1;
예제 #2
0
* of the code written by Facebook, Inc are 
* Copyright 2006-2008 Facebook, Inc. All Rights Reserved.
*
*
********END LICENSE BLOCK*********/
// Facebook Copyright 2006 - 2008
include_once $_SERVER['PHP_ROOT'] . '/lib/core/init.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/auth.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/api_xml.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/api_json.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/errorcodes.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/session.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/application.php';
include_once $_SERVER['PHP_ROOT'] . '/lib/api/1.0/implementation.php';
// Fetch method name and session key
param_request(array('method' => $PARAM_STRING, 'session_key' => $PARAM_STRING, 'format' => $PARAM_STRING, 'callback' => $PARAM_STRING, 'v' => $PARAM_STRING));
$version = api_resolve_version($req_v);
// Sanitize response format
$format = strtolower($req_format);
if (!in_array($format, array('xml', 'json'))) {
    $format = 'xml';
}
// Set content type
if ($req_callback) {
    header('Content-type: text/javascript');
} else {
    if ($format == 'json') {
        header('Content-type: application/json');
    } else {
        header('Content-type: text/xml');
    }