Support » Plugin: Software License Manager » return is null (registered_domain)

  • Hello
    I want to check the license and coordinate with the address of the requesting site
    Please check the following code
    The “registered_domain” or “item_reference” tag is returned empty.
    Please correct.
    // ————-file: License.php —————– //

    <?php
    function License_clicked($postURL, $secretKey, $license_key) {
    	// prepare the data
    	$data = array ();
    	$data['slm_action'] = 'slm_check';
    	$data['secret_key'] = $secretKey;
    	$data['license_key'] = $license_key;
    	// send data to API 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);
    	$obj = json_decode($returnValue);
    
        $out['status'] = $status= ($obj->{'status'});
    	$out['email'] = $status= ($obj->{'email'});
    	$out['max_allowed_domains'] = $status= ($obj->{'max_allowed_domains'});
            $out ['registered_domain'] = $status= ($obj->{'registered_domain'});
    	$out['item_reference'] = $status= ($obj->{'item_reference'});
    	$out['date_created'] = $status= ($obj->{'date_created'});
    	$out['date_renewed'] = $status= ($obj->{'date_renewed'});
    	$out['date_expiry'] = $status= ($obj->{'date_expiry'});
            
    	return $out;
    
    }
    ?>

    // ————-file: License_clicked.php —————– //

    <?php
    require_once('license.php');
    
    $data=License_clicked("http://www.name.com","87970825ef7727.22119413","5997084dcd47f");
    
    $status= $data['status'];
    $email= $data['email'];
    $max_allowed_domains= $data['max_allowed_domains'];
    $registered_domain= $data['registered_domain'];
    $item_reference= $data['item_reference'];
    $date_created= $data['date_created'];
    $date_renewed= $data['date_renewed'];
    $date_expiry= $data['date_expiry'];
    $message="";
    
    if ($status == "active") {
    	if ($date_expiry > date(“Y-m-d”)) {
    		if ($registered_domain == $_SERVER['SERVER_NAME']) {
    			$message="License is: active";
    		} else {
    		   $message="not registered domain";
    			}	
    	}else {
    		$message="License is expiry";
    		}
    } else {
    	switch ($status) {
    		case "expired":
    			$message="status is: expired";
    			break;
    		case "pending":
    			$message="status is: pending";
    			break;
    		case "blocked":
    			$message="status is: blocked";
    			break;
    		
        }   
    }
    echo $message;	
    ?>
Viewing 1 replies (of 1 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, I have submitted a message to the developers to further investigate your code.

    Kind regards

Viewing 1 replies (of 1 total)
  • The topic ‘return is null (registered_domain)’ is closed to new replies.