The product key was not found

I have some php code that works most of the time when run against the LimeLM API, but sometimes gets the following error:

Failed to get Key ID: (1) The product key was not found.LicenseID = 6xd2gfu88kcgfzx6itpy85mscwta

Notice that the key varies depending on the request but is a valid key.

A snip of the code that I run that gets the error is below:

$licenseID = $_POST['licenseID'];$pkeys = "";

// Get License key from server

require('LimeLM.php');

LimeLM::SetAPIKey($LimeAPIKey);$version_id = 'My Version ID Is HERE';$bSuccess = false;$pkeys = "";$errorMsg = "";try{ // First get the product key $xml = new SimpleXMLElement(LimeLM::GetPKeyID($version_id, $licenseID)); if ($xml['stat'] != 'ok') { // use the error code & message $errorMsg = 'Failed to get Key ID: ('.$xml->err['code'].') ' . $xml->err['msg']; report($licenseID, $errorMsg); // this sends the error message exit ('Invalid License'); }// More code}

Is there something I'm doing wrong that it fails sometimes? The license ID used is one that is valid so it is unclear why the GetPKeyID is failing.

Thanks for any ideas on what might be wrong.

Everything is working fine here. You're going to have to give us more information. Preferably something to reproduce what you're finding (like a product key that is failing).

Note that the function assumes the product key is properly formed (with dashes and all). It's much more strict than the TA_CheckAndSavePKey() function.