Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //loads api functions
- require "../api.php";
- //defines location of export files
- $fileLocation = "C:\Program Files (x86)\Zend\Apache2\htdocs\analyticshumanly\data\bears.txt";
- //defines adminhost
- $adminhost = "cognosdemo";
- //defines TM1 server
- $server = "api";
- //defines username
- $user = "admin";
- //defines password
- $password = "apple";
- //gets server method issued by client
- $method = $_SERVER['REQUEST_METHOD'];
- //claer file
- clearFile($fileLocation);
- //execute request
- executeRequest($method, $fileLocation, $error, $adminhost, $server, $process, $user, $password);
- /**
- *
- * Clears file before export
- *
- * @param $fileLocation location of file with exported data
- */
- function clearFile($fileLocation){
- file_put_contents($fileLocation,"");
- }
- /**
- *
- * Depending on REQUEST_METHOD function executes different processes
- *
- * @param $method HTTP method issed by client
- */
- function executeRequest($method, $fileLocation, $error, $adminhost, $server, $process, $user, $password){
- switch ($method){
- case "GET":
- $process = "exportCubeBears";
- $message = executeProcess($adminhost, $server, $process, $user, $password);
- //issue message if any error occured
- if ($message!=0){
- echo $error[$message];
- }
- else {
- $data = getData($fileLocation);
- echo $data;
- }
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement