Hi sir.
I try to set up the PHP code on my plugin and i had already activated the plugin.
Notice: Trying to get property 'result' of non-object in /home/genesissolutions/public_html/dev/wp-content/plugins/sample-plugin/slm-sample-plugin.php on line 74
Notice: Trying to get property 'message' of non-object in /home/genesissolutions/public_html/dev/wp-content/plugins/sample-plugin/slm-sample-plugin.php on line 86
The following message was returned from the server:
CODE:
// 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. Please can you help me about this. Thank you so much