Working Verifiy Purchase code

i am looking for working php file to check the customers purchase code and then activate the software (windows ‘exe’ file).
i will upload the php file to my server and call it from my exe file to check the license.
and if response is valid, then the software will activate.
“i’ll save the only valid response in the hidden place on the client computer to void the checking everytime program start”.
also i need th php file have a code to NOT allow the purchase code to register on another place or register twice.

Thanks for your help

Try this out:

Thank you for the link, but this is a full script to create a page for license checker tool.
i think i’ll use it later in the second step.
but now i need a simple php code just for check if license is valid or not or used before, so i can easly call it with C# and VB.NET code.

Ok, i found that code and i’ve edited it to be able to work with VB.NET and C# and i tested it and it worked great.
but now i want to add a line of code to check if the purchase code are registerd before or not.

	$code= trim($_POST['purchase_code']); // have we got a valid purchase code?
	$url = "".$code;
	$curl = curl_init($url);
	$personal_token = trim($_POST['personal_token']);
	$header = array();
	$header[] = 'Authorization: Bearer '.$personal_token;
	$header[] = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:41.0) Gecko/20100101 Firefox/41.0';
	$header[] = 'timeout: 20';
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
	$envatoRes = curl_exec($curl);
	$envatoRes = json_decode($envatoRes);
	$date = new DateTime($envatoRes->supported_until);
	$boughtdate = new DateTime($envatoRes->sold_at);
	$bresult = $boughtdate->format('Y-m-d H:i:s');
	$sresult = $date->format('Y-m-d H:i:s');
		if (isset($envatoRes->item->name)) {   
				$data = " - Verification Success:  ({$envatoRes->item->name})  -  (Bought Date: {$bresult} )  - (Support Till: {$sresult})";
		} else {  
				$data= " - FAILED: Invalid Purchase Code";
	echo $data;

Hi Organd,
You can check the script here:

1 Like