PHP Classes

File: web/api.php

Recommend this page to a friend!
  Classes of Manuel Lemos   PHP OAuth2 Server Library   web/api.php   Download  
File: web/api.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP OAuth2 Server Library
Implements an API provider using OAuth 2 protocol
Author: By
Last change: Update of web/api.php
Date: 11 months ago
Size: 855 bytes
 

Contents

Class file image Download
<?php
/*
 * api.php
 *
 * @(#) $Id: $
 *
 */

   
define('APPLICATION_PATH', '..');

    require(
APPLICATION_PATH.'/vendor/autoload.php');

   
$options = new oauth2_server_configuration_options_class;
   
$options->application_path = APPLICATION_PATH;
   
$options->initialize();

    if(
$options->maintenance)
       
$case = new oauth2_server_maintenance_class;
    else
       
$case = new oauth2_server_api_class;
   
$case->options = $options;
    if((
$success = $case->initialize()))
       
$success = $case->finalize($case->process());
    if(
$case->exit)
        exit;
    if(
$success)
       
$case->output();
    else
    {
       
$error_case = new oauth2_server_error_class;
       
$error_case->options = $options;
       
$error_case->error = $case->error;
       
$error_case->web = false;
       
$error_case->api = true;
        if(
$error_case->initialize()
        &&
$error_case->finalize($error_case->process()))
           
$error_case->output();
    }
?>