Express Entry:Token Server Support

From Melissa Data Wiki
Jump to: navigation, search

← Express Entry Reference

← Express Entry Reference

Express Entry Navigation
Introduction
Getting Started
Global Getting Started
Global Terms
Endpoints
ExpressAddress
ExpressCityState
ExpressFreeForm
ExpressPostalCode
ExpressStreet
GlobalExpressAddress
GlobalExpressCountry
GlobalExpressLocalityAdministrativeArea
GlobalExpressFreeForm
GlobalExpressPostalCode
GlobalExpressThoroughfare
Response
XML Response
JSON Response
Global XML Response
Global JSON Response
Token Server
Result Codes
Express Entry Result Codes
Sample Code
US CSharp
US JavaScript
US Visual BASIC
Global CSharp
Global JavaScript
Token Server Support



Token Server Operation Guide

File:Token server operation.pdf

Token Server Support Sample Project

Token Server Support Sample Code

PHP Code

<?php
  // change this to your License Key
  $License = '########';

  //APACHE - You can use any other ways to get your external IP. Make sure that its echoing external IP not internal LAN IP.
  //Depending on how secure or optimized you want to capture your IP address. You may want to change how IP is determined
  //EXAMPLE ONLY
  //$host= gethostname();
  //$ip = gethostbyname($host);

  //IIS
  //EXAMPLE ONLY
  $ip = gethostbyname($_SERVER['SERVER_NAME']);
  //check for function
  if ( !isset($_REQUEST['function']) )
    exit();
  else
    $func = $_REQUEST['function'];
    //get the token
      if ($func == 'gettoken')
      {
        //customize the token request
        //example for Check Action
        $xml = file_get_contents('http://token.melissadata.net/v3/web/Service.svc/RequestToken?L=' . $License . '&P=pkgExpressEntry&IP=' . $ip);
        //Personator Packages
        //pkgBorgCheck Personator Web Service (Check Action)
        //pkgBorgVerify Personator Web Service (Verify Action)
        //pkgBorgMoveUpdate Personator Web Service (Move Update Action)
        //pkgBorgAppend Personator Web Service (Append Action)
        //pkgBorgGeoCode Personator Web Service (Geocode Action)
        //pkgBorgGeoPoint Personator Web Service (GeoPoint Action)
        //pkgExpressEntry  Express Entry
        //unpack the xml
        $xml_r = new SimpleXMLElement($xml);
        //grab out the token
        $token = (string)$xml_r->Token;  

        //send the token to the client in a json packet
        $data[] = array('token' => $token);
        //this encodes the data and sends it back to the client
        echo json_encode($data);
        flush();
      }
?>

JavaScript Code (for your web page)

var token;
window.onload = function()
{
  $.ajax(
  {
    type: "POST",
    // Your PHP server hostname or IP in the following line
    url: "http://192.168.13.237/licensekey.php", //NOTE:  ajax requires that the client and server side scripts be located on the same domain
    data: {function:"gettoken"},
    dataType: 'json',
    success: function(data) 
    {
      token = data[0].token;
      //alert(token); // uncomment this if you want to see the token being returned
    }
  });
}
Personal tools
Namespaces

Variants
Actions
Navigation
Products
Support