Firstly, change your API key on your setting page. You shouldn't post the API key publicly. Consider it like a password to your account.
It is getting an error during testing.
What's the error?
I'm using more than 1 license field in my PHP for Fastspring. It is getting an error during testing.What am I doing wrong?
<?php//TODO: set your API key found in http://wyday.com/limelm/settings/$api_key = 'REMOVED';
//TODO: set the version id to generate & find keys for// the version id is found in the url. For example http://wyday.com/limelm/version/100/// the version id is 100.$version_id = '1590';
//TODO: Use any feature values here
$feature_names = array('CompanyName');$feature_values = array($company);
$feature_names1 = array('total_activations');$feature_values1 = array('6');
$post_data = array( 'method' => 'limelm.pkey.generate', 'version_id' => $version_id, 'num_keys' => 1, 'num_acts' => 6, 'email' => $email, 'api_key' => $api_key, 'nojsoncallback' => 1, 'format' => 'json');
if ($feature_names !== null){ $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values;
$post_data['feature_name'] = $feature_names1; $post_data['feature_value'] = $feature_values1;}
// urlencode $post_data$post_string = '';foreach ($post_data as $key => $value){ if (is_array($value)) { foreach ($value as $sub_value) { $post_string .= $key.'[]='.urlencode($sub_value).'&'; } } else $post_string .= $key.'='.urlencode($value).'&';}$post_string = rtrim($post_string, '& ');
$request = curl_init('https://wyday.com/limelm/api/rest/');curl_setopt($request, CURLOPT_HEADER, 0);curl_setopt($request, CURLOPT_ENCODING, "");curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);curl_setopt($request, CURLOPT_SSL_VERIFYPEER, TRUE);
try{ $jObj = json_decode(curl_exec($request));
if ($jObj->stat == 'ok') { foreach ($jObj->pkeys->pkey as $pkey) { echo $pkey->key."\r\n"; } } else { // Uncomment the next line to see the error LimeLM is giving you. echo $jObj->message; }}catch (Exception $e){ // Uncomment the next line to see the exception. echo 'Failure: '.$e->getMessage();}
?>
Firstly, change your API key on your setting page. You shouldn't post the API key publicly. Consider it like a password to your account.
It is getting an error during testing.
What's the error?
license field is total_activations , type integer, required.the error is:You must enter a value for the feature "total_activations". It's a required feature.I have reposted the code:
//TODO: Use any feature values here
$feature_names = array('CompanyName');$feature_values = array($company);
$feature_names1 = array('total_activations');$feature_values1 = array(6);
$post_data = array( 'method' => 'limelm.pkey.generate', 'version_id' => $version_id, 'num_keys' => 1, 'num_acts' => 6, 'email' => $email, 'api_key' => $api_key, 'nojsoncallback' => 1, 'format' => 'json');
if ($feature_names !== null){ $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values;
$post_data['feature_name'] = $feature_names1; $post_data['feature_value'] = $feature_values1; }
Thanks you.
You must enter a value for the feature "total_activations". It's a required feature.
That's telling you exactly what the error is. You have a custom license fields called "total_activations" and you set it to be required (that is, it must be filled).
$feature_names = array('CompanyName');$feature_values = array($company);
$feature_names1 = array('total_activations');$feature_values1 = array(6);
That's wrong. Do this:
$feature_names = array('CompanyName', 'total_activations');$feature_values = array($company, '6');