Some more info:
The below script is working, with the pkey_id entered manually. I just need to know how to get FastSpring to know the pkey_id.
<?php//TODO: set your API key found in http://wyday.com/limelm/settings/$api_key = 'xxxxxxxxxxxxxxxxxxxxxxx';
//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 = 'xxxxxxxxx';
//Manual Product Key ID. Need to insert this automatically$pkey_id = 'xxxxxxxx';
//TODO: Use any feature values here$feature_names = array('ExpireDate');$feature_values = array(date('Y-m-d'));
$post_data = array( 'method' => 'limelm.pkey.setDetails', 'api_key' => $api_key, 'pkey_id' => $pkey_id, 'nojsoncallback' => 1, 'format' => 'json');
if ($feature_names !== null){ $post_data['feature_name'] = $feature_names; $post_data['feature_value'] = $feature_values;}
// 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();}?>