<pre>
<?php
/* In this demonstration we will be demonstrating how to authorize your application to use a Panacea Mobile user's account */
require_once("../../php/panacea_api.php"); // Let's just include the Panacea Api class (downloadable at http://www.panaceamobile.com/developers/sample-code/php/)
/* First, we need to contact Panacea Mobile servers in order to let them know that we will be sending a user to them for authorization */
$application_name = "My Application";
/**
* If needed, after the application has been authorized, Panacea Mobile can redirect the user to a success page or failed page on your server
*
* If these values are not specified, the user will just be given the option to close the window (for use on Mobile phones for example)
*
* An HTTP GET variable 'request_key' will be appended to this URL for tracking purposes
*
*/
$return_url = "http://console.panaceamobile.com/examples/demos/api_key_creation/step2.php";
$icon_url = null; /* A URL containing an icon to make your application easily identifiable to the user (optional) */
if($api->ok($request_key)) {
/* We have a request key to use */
/* We are going to store the request key in a session for simplicity */
$_SESSION['api_request_key'] = $request_key['details']['request_key'];
/* Now we must present the user with the authorization page for Panacea Mobile to allow this user to authorize our application */
echo
"<a href='".
htmlspecialchars($request_key['details']['authorize_url']).
"'>authorize now with Panacea Mobile</a>";
exit(0);
}
echo "Unable to generate request key";
?>
</pre>