Fastspring Integration

Hello,

I'm setting up an account with FastSpring, who have the option of hosting a PHP script. I was just wondering if you have a standard script for that?

Best Regards,

John King

Hey John,

We don't have a pre-built script, but you can integrate LimeLM directly in your order process. Look at the pp-checker.php script in the LimeLM web API to see how you can generate product keys on the fly.

Also, FastSpring has a backend called SpringBoard that you can use to tie together your code in the order process. Here's a blog post about it.

Hi Wyatt,

Thanks for getting back to me, I went through the API code and managed to write a script that will generate license keys, itterate through the XML and output a carriage return seperated list of license keys (which is the format they need).

It all works perfectly on localhost, but on their server it always throws a java.lang.NullPointerException: null after some trial and error I tracked it down to the code that converts the XML to an array, I've tried all the functions I can find for it and the all cause an error.

I've dropped a line to their tech support so hopefully they will have a solution. Worst case scenario I could install the script on my site, so their site calls my site which calls your site. Not ideal, but it would work 🙂

Best Regards,

John King

For anyone interested, I got it working by taking out the XML parsing and using strpos instead:

LimeLM::SetAPIKey('MYAPIKEY');$string = LimeLM::GeneratePKeys(MYID,$quantity,1,$email);$xml = simplexml_load_string($string);$string = print_r($xml, true);

$found = true;while ($found) { $loc = strpos($string,'[key] => '); if ($loc !== FALSE) { $string = substr($string,$loc + 9); $loccr = strpos($string,chr(10)); if ($loccr !== FALSE) { $license = substr($string,0,$loccr); print $license . chr(13) . chr(10); $string = substr($string,$loccr+2); } } else { $found = false; break; }}

Instead of using:

$string = LimeLM::GeneratePKeys(MYID,$quantity,1,$email);

You should use:

$string = LimeLM::GeneratePKeys(MYID,1,$quantity,$email);

The reason is that you want to create a single key with multiple activations, not multiple keys with 1 activation. Does this make sense?