12 Replies Latest reply on Oct 7, 2016 3:44 PM by ZoocMan85

    Serial Key API (HTTP POST)

    ZoocMan85

      Hey Everyone,

       

      So im fooling around with this api program to have my runtime apps get verified when they start by a serial key. Here is the PHP code if you were creating a new license key.

       

      /*** Mandatory data ***/

      // Post URL

      $postURL = "";

      // The Secret key

      $secretKey = "";

       

      /*** Optional Data ***/

      $firstname = "John";

      $lastname = "Doe";

      $email = "john.doe@gmail.com";

       

      // prepare the data

      $data = array ();

      $data['secret_key'] = $secretKey;

      $data['slm_action'] = 'slm_create_new';

      $data['first_name'] = $firstname;

      $data['last_name'] = $lastname;

      $data['email'] = $email;

       

      // send data to post URL

      $ch = curl_init ($postURL);

      curl_setopt ($ch, CURLOPT_POST, true);

      curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);

      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);

      $returnValue = curl_exec ($ch);

       

      // Process the return values

      var_dump($returnValue);

       

      ----------------------------------------------------------

      Here is the code for checking a key

      ----------------------------------------------------------

       

      api_params = array(

      'slm_action' => 'slm_check',

      'secret_key' => '',

      'license_key' => 'KEYTOCHECK',

      );

      // Send query to the license manager server

      $response = wp_remote_get(add_query_arg($api_params, YOUR_LICENSE_SERVER_URL), array('timeout' => 20, 'sslverify' => false));

      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      Here is my script in filemaker. I cant get it to connect and send a return value back. Now for the sake of this post , i remove the URL im sending it to and my API key. Any ideas on what im doing wrong on this ? Thanks for your help.

       

      script.jpg