get_license

Returns the license activation code(s) associated with the end user’s email address. If an end user ever forgets or loses their license email, your web server can use this API call to allow the user to retrieve their license email again.

Functional Limitation Notice: If the end user has a single email associated with many licenses, then only the first license will be emailed to the end user. This notice will be listed until the API is finished upgrading to support multiple emails per license. Once this has been resolved and upgraded, this notice will disappear.

Required Parameters

  • email = (string) end user’s valid email address.

Quick PHP Example

This is a real-world example using get_license to send an end user their license activation code(s). First the example script uses the API call email_exists to check that the developer has an end user with that email. If the email does not exist, then the user is notified that their email address is not associated with a license, and they should try another email. When a user-supplied email is found, then that email is sent a message containing the license activation code.

Note that the following are functions you will need to create in your script:

  • valid_email( ) — determines if the email is valid.
  • LicenseAPI( ) — calls the license API and returns the license result(s).
  • DisplayForm( ) — displays the initial form that asked for the end user’s email.
  • SendEmail( ) — any function approved by your web server to send emails.
  • Finished( ) — some function that displays a “we’re done” message for the user.

This is the type of script that you will most likely want running on your company’s web server, under a section similar to, “Help! I lost my license activation code!”

/**
 * this code snippet runs after a user submits (via a POST form) their email
 * address that they believe is associated with their license. the email 
 * address could have been retrieved from their online purchase of your
 * application.
 */
if (valid_email($_POST['user_email'])) {
	// STEP 1: generate the end user's "license reminder" email
	$params['call']  = 'get_license';
	$params['email'] = $_POST['user_email'];
	$results = LicenseAPI($params);
 
	$subject = 'Your License Code';
	// plural suffix
	if (count($results) > 1)
		$subject .= 's';
	$message = "Below are your license code(s):\n\n";
	foreach ($results as $license_code) {
		$message .= "$license_code\n";
	}
	$message .= "\n\n You should keep this information very secret, so ";
	$message .= "don't share this email message with anyone!";
 
	// STEP 2: send the email already!
	SendEmail($_POST['user_email'], $subject, $message);
 
	// STEP 3: give customer their final message.
	Finished();
	echo "...now go check your email!<br>";
}

Successful Return String

On success, get_license will return all licenses associated with the end user’s email address. Below is an example of an entire result array with 2 licenses:

<license>
JQ-Y46L1I-E24G
JTX-36L0S-TA-LC

Unsuccessful Return Strings

F = In the event that the email is not associated with any license, get_license will simply only return ‘F’–of course, after the initial <license> tag:

<license>
F

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This site is using OpenAvatar based on