Skip to content

Activate license sample

Michel edited this page Dec 30, 2018 · 2 revisions
    $sml_url    =  'enter_website_api_here';
    $slm_action = 'slm_activate';

    $registered_devices = '' //get device id here;
    if(empty($registered_devices)) {
        $registered_devices = gethostname();
    }
    $secret_key  = 'enter_secret_key_here';
    $license_key = 'enter_license_key_here';
    $api_call    = $sml_url.'?registered_devices='.$registered_devices.'&secret_key='.$secret_key.'&slm_action='.$slm_action.'&license_key='.$license_key;
    define('URL_SERVICE', $api_call);
    $ch         = curl_init();
    curl_setopt($ch, CURLOPT_URL, URL_SERVICE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $json       = curl_exec($ch);
    curl_close($ch);
    $response   = json_decode($json, true);
    $result     = $response["result"];
    $message    = $response["message"];

    if($result =='error'){
        echo 'error message here ';
    }
    elseif($result =='success' || $result =='Success'){
        echo 'success message here'
    }
Clone this wiki locally