Ejemplo n.º 1
0
<?php

require_once '../libs/class.CesGateway.inc.php';
$result = array_key_exists('HTTP_MOD_REWRITE', $_SERVER);
//echo "RESULT-->".$result."<br/>";
$request = $_SERVER['REQUEST_URI'];
//this would be /users/show/abc.json
$cgw = new CesGateway();
$result = $cgw->login();
if ($result) {
    print $cgw->getSaldo();
}
//close connection
curl_close($cgw->ch);
//echo "REQUEST-->".$request."<br/>";
/*$app = new Slim();

$app->get('/saldo', 'getSaldo');
// $app->get('/wines/:id',	'getWine');
// $app->get('/wines/search/:query', 'findByName');
// $app->post('/wines', 'addWine');
// $app->put('/wines/:id', 'updateWine');
// $app->delete('/wines/:id',	'deleteWine');

$app->run();

function getSaldo() {
	$cgw = new CesGateway();
	$result = $cgw->login();
	if ($result) {
		print $cgw->getSaldo();	
Ejemplo n.º 2
0
    //die(print_r($trade));
    $cra = new CesRestAPI();
    print $cra->insertTradeSQL($trade);
})->setName('trades put');
//Recommend all
$app->get('/recommend/all', function () {
    $cra = new CesRestAPI();
    print $cra->getAllRecommendsJSON();
})->setName('recommend all');
//Recommends by user
$app->get('/recommend/:uid', function ($uid) {
    $cra = new CesRestAPI();
    print $cra->getRecommendsByUserJSON($uid);
})->setName('recommends by user');
$app->get('/balances/all', function () {
    $cgw = new CesGateway();
    $result = $cgw->login();
    if ($result) {
        print $cgw->getExportCSVJson("balances");
    }
    //close connection
    curl_close($cgw->ch);
})->setName('Balances all');
// POST route
$app->post('/post', function () {
    echo 'This is a POST route';
});
// PUT route
$app->put('/put', function () {
    echo 'This is a PUT route';
});