Set up php code for activate license
-
Hi please, can you help me with this? I tried to set up the PHP code on my plugin and I had already activated the plugin.
define('YOUR_SPECIAL_SECRET_KEY', 'removed by moderator'); define('YOUR_LICENSE_SERVER_URL', 'https://www.genesisbusinesssolutions.com'); define('YOUR_ITEM_REFERENCE', 'My First Plugin'); // API query parameters $api_params = array( 'slm_action' => 'slm_activate', 'secret_key' => YOUR_SPECIAL_SECRET_KEY, 'license_key' => $license_key, 'registered_domain' => $_SERVER['SERVER_NAME'], 'item_reference' => urlencode(YOUR_ITEM_REFERENCE), ); // 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)); // Check for error in the response if (is_wp_error($response)){ echo "Unexpected Error! The query returned with an error."; } //var_dump($response);//uncomment it if you want to look at the full response // License data. $license_data = json_decode(wp_remote_retrieve_body($response)); // TODO - Do something with it. //var_dump($license_data);//uncomment it to look at the data if($license_data->result == 'success'){//Success was returned for the license activation //Uncomment the followng line to see the message that returned from the license server echo '<br />The following message was returned from the server: '.$license_data->message; //Save the license key in the options table update_option('sample_license_key', $license_key); } else{ //Show error to the user. Probably entered incorrect license key. //Uncomment the followng line to see the message that returned from the license server echo '<br />The following message was returned from the server: '.$license_data->message; }I think the response has an empty value response. What am I missing in the code?
Thank you so much
- This topic was modified 3 years, 10 months ago by .
- This topic was modified 3 years, 10 months ago by .
- This topic was modified 3 years, 10 months ago by .
- This topic was modified 3 years, 10 months ago by .
- This topic was modified 3 years, 10 months ago by .
- This topic was modified 3 years, 10 months ago by . Reason: formatting
- This topic was modified 3 years, 10 months ago by . Reason: secret key removed
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Set up php code for activate license’ is closed to new replies.