PHP Classes

File: api.php

Recommend this page to a friend!
  Classes of Luis Toscano   Easy API   api.php   Download  
File: api.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Easy API
Handle API calls by mapping requests to functions
Author: By
Last change:
Date: 5 years ago
Size: 1,478 bytes
 

Contents

Class file image Download
<?php

/*
  ___ ______ _____ _ _ ___ ___
 / _ \| ___ \_ _| | | | | | \/ |
/ /_\ \ |_/ / | | | | ___ ___ | | _| . . | ___
| _ | __/ | | | | / _ \ / _ \| |/ / |\/| |/ _ \
| | | | | _| |_ | |___| (_) | (_) | <| | | | __/
\_| |_|_| \___/ \_____/\___/ \___/|_|\_\_| |_/\___|
                                                       
                                                  

*/

 ////// Definitions
 
 //include 'config/config.php';

 
define('LIBS', 'libs');
 
$qs = $_SERVER['QUERY_STRING'];
 
$config = ['appserver' => 'ionic', 'jwtenabled' => true];
 
$factory = array();
 
$library = array(
 
'mixing' => '',
 
'orm' => $link
 
);

////// SimpleCore
 
include 'config/_bootstrap.php';
 include
'config/easyAuth.php';

////// Security Actions
 
$onlypost = array('save','get');

////// Actions Zone

function hello(){
  GLOBAL
$factory;
  echo
'?? lol ??';
}

function
halo(){
  echo
'?? aloh ??';
}

function
trucks($json = false){
  if(
$json == 'json'){
    echo
json_encode(factory(null, 'orm')->query("SELECT * FROM trucks"));
  }else{
    echo
factory(null, 'orm')->toTable("SELECT * FROM trucks");
  }
}

function
save($data = array()){
  GLOBAL
$factory;
  echo
'Saving Data '.$data['ipclient'];
 
factory(null, 'orm')->insert(array('tabla' => 'look_track', 'reg' => array('ip'=>$data['ipclient'], 'hostname'=>$data['hostname'])));
}


////// Simple Execute API

runner();