Example Integration Code

Below are 4 example PHP files that illustrate how to integrate DoppelMe avatars within your website using the SOAP API. These are given for example only and no warranty is provided. These example are given in PHP - but the same prinicples can be applied to code in other languages/frameworks.

doppelme.php | profile_avatar.php | profile_avatar_create.php | profile_avatar_updated.php

A simple page showing the completed avatar

A landing page once a user has updated their avatar. Not obligatory - you could just redirect users back to their profile page for example.
<?php session_start(); ?>
<?php include("doppelme.php"); ?>
<?php
    // This is just an simple example landing page. 
    // After a user has updated their avatar you would probably send them to their 
    // profile page rather than here    

    
    

    //your user's id (i.e. the id that your site uses to identify your user)
    if(isset($_SESSION['UserID'])) {
        $USER_ID = $_SESSION['UserID'];
    } else {
        //user hasnt logged in or session expired?
        header( 'Location: http://[www.yoursite.com]/please_login.php' ); 
    }

    //Get avatar key from your database. (sql below is just example code)
    /*
    sSQL = "select DoppelMeKey from [YourUserTable] where UserID=" & $USER_ID
    oRS.Open sSQL, oDB
        $sDOPPELME_KEY = oRS("DoppelMeKey")
    oRS.Close
    */
    $sDOPPELME_KEY = $_SESSION['DoppelMeKey'];


    //Avatar image
    $sAVATAR = "http://www.doppelme.com/60/TRANSPARENT/" . $sDOPPELME_KEY . "/avatar.png";
    $sAVATAR = "<img src=\"" . $sAVATAR . "\" alt=\"DoppelMe Avatar\">";
    
?>

<html>
<head>
</head>
<body>


    <table style="width: 400px; margin: 0 auto; text-align:center;">
    <tr><td><?php echo $sAVATAR; ?></td></tr>
    <tr><td>Your avatar has been updated!</td></tr>
    </table>
    
</body>
</html>        




Copyright © 2006-2018 DoppelMe. All rights reserved.