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

Constants and Utility Functions

Include these constants and utility functions in any pages which make API calls.
<?php
//-------------------------------------
//DoppelMe Constants
//-------------------------------------
$DOPPELME_SITE        = "http://api.doppelme.com";
$DOPPELME_SERVICE        = "http://services.doppelme.com/partnerservice.asmx?WSDL";     
$DM_PARTNER_ID        = 1;  //put your partner id here
$DM_PARTNER_KEY        = "A";  //put your partner key here

//-------------------------------------
//DoppelMe Functions
//-------------------------------------

function TestSetup() {

    global $DOPPELME_SERVICE;
    $client = new SoapClient( $DOPPELME_SERVICE , array('trace' => 1)  );     
    //echo "client:\n";
    //var_dump($client);

    //echo "\nAvailable methods:\n";
       //var_dump($client->__getFunctions());

    echo "\n\nCurrent Version:\n";
    var_dump($client->Version()->VersionResult);        
}


function PartnerServiceCall($sURL, $sPARAMS) {
    
    global $DOPPELME_SERVICE;
    
    $client = new SoapClient( $DOPPELME_SERVICE ); 
    $sReturnXML = $client->__soapCall( $sURL, $sPARAMS );
    
    return $sReturnXML;
}


    

//a very simple sanitizer function given here purely as an example.
//you should use your own more robust/complete sanitizer 
function CleanTaintedInput($sText) {

    $sClean = $sText;    
    $sClean = str_replace($sClean,"'","");
    $sClean = str_replace($sClean,";","");
    
    return $sClean;
}

?>    




Copyright © 2006-2018 DoppelMe. All rights reserved.