コード例 #1
0
/**
 * Displays the requested action.
 */
function displayAction($action)
{
    global $service;
    // Render the required action.
    include_once 'examples/' . $action[0] . '/' . $action[1] . '.php';
    $class = $action[1];
    $example = new $class($service);
    printHtmlHeader($example->getName());
    try {
        $example->execute();
    } catch (Google_Exception $ex) {
        print_r($ex);
        print 'An error as occurred while calling the example:<br/>';
        print $ex->getMessage();
    }
    printSampleHtmlFooter();
}
コード例 #2
0
        $action = $_GET["action"];
        if (!in_array($action, $actions)) {
            die('Unsupported action:' . $action . "\n");
        }
        // Render the required action.
        require_once 'examples/' . $action . '.php';
        $class = ucfirst($action);
        $example = new $class($service);
        printHtmlHeader($example->getName());
        try {
            $example->execute();
        } catch (apiException $ex) {
            printf('An error as occurred while calling the example:<br/>');
            printf($ex->getMessage());
        }
        printSampleHtmlFooter();
    } else {
        // Show the list of links to supported actions.
        printHtmlHeader('Double Click Bid Manager API PHP usage examples.');
        printExamplesIndex($actions);
        printHtmlFooter();
    }
    // The access token may have been updated.
    $_SESSION['service_token'] = $client->getAccessToken();
}
/**
 * Builds an array containing the supported actions.
 */
function getSupportedActions()
{
    return array('GetLatestReport', 'DownloadLineItems', 'UploadLineItems');