2

I want to try to have Advanced Installer validate a serial number through Gumroad's license key API, and unfortunately, Advanced installer won't allow me to change the POST query name, as instead it wants to POST to a PHP file that contains the query value. Is there a way to translate from AI's sn query to license_key? I have combined a PHP file that sends the user inputed key to the PHP file that'll send to gumroad's licensing API

<?php

$request = new HttpRequest();
$request->setUrl('http://api.gumroad.com/v2/licenses/verify');
$request->setMethod(HTTP_METH_POST);

$request->setQueryData(array(
  'product_permalink' => '[GUMROAD_PRODUCT_CODE]',
  'license_key' => $sn
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

// server response codes
define('LICENSE_VALID',   '200');
define('LICENSE_INVALID', '404');

function ServerResponse($is_valid, $posted_serial = '', $lang_id = 1033)
{
  $msg_sep = "\n";

  // load error messages from your database, using "$lang_id" for localization (optional)

  if($posted_serial == '')
    return LICENSE_INVALID . $msg_sep . "Missing Serial Number !";

  if($is_valid == true)
    return LICENSE_VALID;
  else
    return LICENSE_INVALID . $msg_sep . "Serial Number: " . $posted_serial . ' is invalid !';
}

else
{
  // issue error response
  echo ServerResponse(false);
  die();
}

?>
mikey186
  • 165
  • 16

1 Answers1

0

If you are using the serial validation feature of Advanced Installer it seems the only POST parameter their serial validation feature can POST are: sn, username, company, email, version, languageid and ai. So, based on their docs I see no way you could add your own post parameter (license_key).

herman.smn
  • 1,214
  • 7
  • 9