PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Rodolfo Pereira Romano   PHP API Server Builder   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP API Server Builder
Build a REST server API from custom classes
Author: By
Last change: Update of example.php
Date: 8 years ago
Size: 1,567 bytes
 

Contents

Class file image Download
<?php
   
include('apibuilder/core/ApiApp.php');
    include(
'apibuilder/language/pt-br.php');
   
   
/* formats */
   
include('apibuilder/formats/all_formats.php');
   
   
/* or */
    //include('apibuilder/formats/json.php');
    //include('apibuilder/formats/php_serialize.php');
    //include('apibuilder/formats/var_export.php');
   
   
include('sampleclass.php');
   
   
$api = new APIApp("http://localhost/api", /*optional*/ new SampleKeyValidator());
   
$api->rewriteUrl = true;
   
$api->baseURI = "api";
   
$api->commandParam = "cmd"; // only for rewriteUrl = false
   
$api->methodParam = "do"; // only for rewriteUrl = false
   
$api->versionParam = "ver"; // default = ver
   
$api->keyParam = "key"; // default = key
   
$api->defaultVersion = 2;
   
$api->run();
       
       
   
/*
       Exemplos de Chamadas / Call Samples
   
       rewriteUrl = true;
        http://rastreio.freeside.com.br/api/random/getNumber
            http://rastreio.freeside.com.br/api/text/getSecureString/?key=75f42660c4109c3dc81101d3a45fa174
           http://rastreio.freeside.com.br/api/text/getSecureString/?key=75f42660c4109c3dc81101d3a45fa174&out=serialize
      
       rewriteUrl = false;
        http://rastreio.freeside.com.br/api/apitest.php?cmd=random&do=getNumber
        http://rastreio.freeside.com.br/api/apitest.php?cmd=text&do=getSecureString&key=75f42660c4109c3dc81101d3a45fa174
        http://rastreio.freeside.com.br/api/apitest.php?cmd=text&do=getSecureString&key=75f42660c4109c3dc81101d3a45fa174&out=serialize
               
         http://rastreio.freeside.com.br/api/random/getNumberRange/?min=1000&max=2000
    */
?>