Exemplo n.º 1
0
<?php

/*
	This is a simple example script that shows how easy is to integrate your application within draugiem.lv.
	Feel free to use it in your own projects.
*/
include 'DraugiemApi.php';
$app_key = 'd6949661ccde33a65d98653043bc3119';
//Application API key of your app goes here
$app_id = 999;
//Application ID of your app goes here
$draugiem = new DraugiemApi($app_id, $app_key);
//Create Passport object
session_start();
//Start PHP session
$draugiem->cookieFix();
//Iframe cookie workaround for IE and Safari
$session = $draugiem->getSession();
//Authenticate user
if ($session) {
    //Authentication successful
    $user = $draugiem->getUserData();
    //Get user info
    ?>
<html>
	<head>
		<title>Draugiem API test</title>
<?php 
    echo $draugiem->getJavascript('body', 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/callback.html');
    //Set up JS API + iframe Resize
    ?>