} $authUrl = $client->createAuthUrl(); } } printHtmlHeader('DCM/DFA Reporting and Trafficking API PHP usage examples'); if (isset($authUrl)) { // No access token found, show the link to generate one print "<a class='login' href='{$authUrl}'>Login!</a>"; } else { print "<a class='logout' href='?logout'>Logout</a>"; } if ($client->getAccessToken()) { // If the action is set, dispatch the action if supported if (isset($_GET['action'])) { $action = decodeActionString($_GET['action']); if (!isValidAction($action)) { die('Unsupported action: ' . $_GET['action'] . "\n"); } displayAction($action); } else { // Show the list of links to supported actions. printExamplesIndex(getSupportedActions()); printHtmlFooter(); } // Note that we re-store the access_token bundle, just in case anything // changed during the request - the main thing that might happen here is the // access token itself is refreshed if the application has offline access. $_SESSION['access_token'] = $client->getAccessToken(); } /** * Displays the requested action.
* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require_once './BearLbProperty.php'; require_once './WebServiceDomain.php'; require_once './SearchEngineCriteria.php'; define('WEB_SERVICE_INVALID', 'Invalid Web Service Request'); define('POST_PARAM_MISSING', 'POST parameter is missing'); define('POST_PARAM_INVALID', 'POST parameter is invalid'); if ($action = filter_input(INPUT_POST, 'action')) { $bearLbProperty = new BearLbProperty(); $webServiceDomain = new WebServiceDomain("89.249.211.235", 8082, ""); $webServiceBaseUrl = $webServiceDomain->getWebServiceUrl(); try { \isValidAction(trim($action)); $reply = array(); $fh = fopen('engine.log', 'a'); fwrite($fh, "===== WEB SERVICE REQUEST ====\n"); fwrite($fh, "Request Time: " . date('Y-m-d H:i:s') . "\n"); foreach ($_POST as $k => $v) { fwrite($fh, "{$k}=>{$v}\n"); } switch ($action) { case 'ws_re_cat': fwrite($fh, "Fetching Cities\n"); $webServiceBaseUrl .= $action; fwrite($fh, "{$webServiceBaseUrl}\n"); $results = ws_re_cat($webServiceBaseUrl); fwrite($fh, "CURL INFO RESULTS\n"); foreach ($results['curl_info'] as $k => $v) {