<?php // php shell.php -p Script/PullData -r ticker=AAPL require_once 'config.php'; use TheBrogue\Controller; use TheBrogue\Model\Project; // Setup the Controller $c = new Controller(); $p = new Project(); $p->load(10693); $da = $p->getDefaultAssumptions(); print_r($da); exit; $c->setMode('SHELL'); // Define Options $short = 'p:'; // Script Path $short .= 'a:'; // Authorized User ID $short .= 'r:'; // Request Parameters $opt = getopt($short, array()); // Assign Path if (!isset($opt['p'])) { echo "-p PATH REQUIRED\n"; exit; } else { $c->setPath(explode('/', $opt['p'])); } // Assign Request Parameters if (isset($opt['r'])) {
use TheBrogue\Controller; // Opens Up AJAX Calls if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: X-Requested-With'); exit; } //else { // header('Access-Control-Allow-Origin: *'); // header('Content-Type: application/json'); //} $c = new Controller(); $d = json_decode(file_get_contents('php://input'), true); switch ($_SERVER['REQUEST_METHOD']) { case 'GET': $c->setMode('GET'); $c->setParams($_GET); break; case 'POST': $c->setMode('POST'); if (is_array($d)) { $c->setParams($d); } else { $c->setParams($_POST); } break; case 'DELETE': $c->setMode('DELETE'); $c->setParams($_REQUEST); break; case 'PUT':