A basic example of a PHP script you would run on your secure web server to use for remote registration, utilizing the CocoaFob Framework.

The CocoaFob Framework is an app registration system that contains both a server side script and also a Cocoa (Obj-C or Swift) based framework you include in your Mac app. You must generate cryptographic public and private keys first - your private key is used on the server side to generate the serial number based on the customer name and email as inputs. The public key is bundled with your Mac app and is used to verify the serial number when the customer enters their name, email, and serial number.

You can read the documentation and download on GitHub.

Our cart will send in a GET/POST request with common fields from the order URL encoded - customer first name, customer last name, customer email address and receipt id (unique purchase identifier). We can also send in custom fields such as product ID, unique key, campaign ID, etc.

In this example, we send in firstname, lastname, email, transaction_id as the URL parameters to your script:

POST /your_registration_script.php?firstname=John&lastname=Smith&email=john_smitch%40google.com&transaction_id=1234567890 HTTP/1.1
Host: yourserver.com
Connection: close
Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client
Content-Type: application/x-www-form-urlencoded
Content-Length: 87

Your PHP script on your secure web server would receive the request, parse the parameters from the order, interface with your own database and the CocoaFob serial number generator, and return the serial number back to our cart.

$customer_first_name = trim(urldecode($_POST["firstname"]));
$customer_last_name  = trim(urldecode($_POST["firstname"]));
$customer_email      = strtolower(trim(urldecode($_POST["email"]));
$transaction_id      = trim(urldecode($_POST["transaction_id"]));


Custom PHP code goes here you will need to implement to store the customer and order in your database


//include the CocoaFob server side script that contains the functions that generate the serial number
//you must also include the dsa_pub.pem and dsa_priv.pem private and public keys in a directory where the script can read them


$lic = new License_Generator;

$code = $lic->make_license("My Cool App", $customer_first_name." ".$customer_last_name , $customer_email);

echo $code;