PHP
The following code example is written in the PHP language:
- <?php
- // Application has Authenticated the user and has access to Roles and Rights
- // Generally the Application would now place the username, roles and IP address into variables
- // The client's IP address can be found with: $_SERVER['REMOTE_ADDR'];
- // Getting SecureKey from Logi Info Application (again the Username, roles and IP address can be variables)
- $logiURL = "http://path/to/app";
- $username = "bob";
- $roles = "admin";
- $rights = "king";
- // Creating URI for SecureKey Call
- $skeyCall = "rdTemplate/rdGetSecureKey.aspx?Username=" . $username . "&Roles=" . $roles . "&ClientBrowserAddress=" . $_SERVER['REMOTE_ADDR'];
- $ch = curl_init($logiURL.$skeyCall);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); $secureKey= curl_exec($ch); curl_close($ch);
- // Alternate way of getting info. Sometimes blocked due to security issues
- // $secureKey= file_get_contents('http://myServer/myLogiApp/rdTemplate/rdGetSecureKey.aspx?Username=bob&Roles=Worker,Manager&ClientBrowserAddress=192.168.4.75')
- // Output the JS Embedded API control
- echo "<div data-autoSizing='all' data-report='default' data-applicationURL='$logiURL'></div>";
- echo "<script src=' + LogiAppURL + '/rdTemplate/rdEmbedApi/rdEmbed.js' type='text/Javascript'></script>";
- // Output the iframe control
- // echo "<div>";
- // echo "<iframe id=\"iframe1\"src=\"http://127.0.0.1/SecureKey/rdPage.aspx?rdSecurekey=" . $secureKey . "\" frameborder=\"0\" onLoad=\"autoResize('iframe1');\" scrolling=\"no\" />";
- // echo "</div>";
- ?>