Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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:
Date: 3 months ago
Size: 1,532 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://rastreio.freeside.com.br/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();
        
        
    
/* 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
    */
?>