我对 BoxBilling Licensing 很陌生,公平地说,他们并没有真正提供任何支持!
我有这段代码来检查是否正常工作的许可证,但是,如果许可证无效,它只会显示单词“Array”,如果它有效,则什么也不显示。
如果许可证无效,我需要知道如何设置不同的消息而不是“数组”,以及如何基本上杀死页面(通过 die() 或类似的东西)。
提前感谢您的帮助!
<?php
include("config.php");
include("opendb.php");
function getLicenseDetails($key)
{
$systeminfo = mysql_query("SELECT * from `systeminfo`");
$systeminfo = mysql_fetch_array($systeminfo);
$url = 'http://clients.pbtechsupport.com/index.php/api/guest/servicelicense/check';
$params = array();
$params['license'] = $systeminfo[licensekey];
$params['host'] = 'localhost';
$params['path'] = dirname(__FILE__);
$params['version'] = '1.0';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
$result = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($code != 200) {
error_log('CURLINFO_HTTP_CODE: '.$code);
}
return json_decode($result, true);
}
$json = getLicenseDetails('test');
if(!$json['valid']) {
print $json['error'];
}
include("closedb.php");
?>