Created
March 6, 2016 16:06
-
-
Save jbmadking/57789210c7867472a881 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* API function | |
* Get domain pricing | |
* includes/api/getdomainpricing.php | |
*/ | |
if (!defined("WHMCS")) { | |
die("This file cannot be accessed directly"); | |
} | |
$apiresults = ['result' => 'error', 'message' => 'No Result found']; | |
$query = "SELECT tblpricing.currency, tblpricing.msetupfee, tblpricing.qsetupfee, tblpricing.ssetupfee, | |
tblpricing.asetupfee, tblpricing.bsetupfee, tblpricing.monthly, tblpricing.quarterly, | |
tblpricing.semiannually, tblpricing.annually, tblpricing.biennially, | |
( | |
SELECT tblcurrencies.prefix | |
FROM tblcurrencies | |
WHERE id = tblpricing.currency | |
) AS curprefix, | |
( | |
SELECT tblcurrencies.suffix | |
FROM tblcurrencies | |
WHERE id = tblpricing.currency | |
) AS cursuffix, | |
( | |
SELECT tbldomainpricing.extension | |
FROM tbldomainpricing | |
WHERE id = tblpricing.relid | |
) AS tld | |
FROM tblpricing | |
WHERE tblpricing.type= 'domainregister' | |
AND !( | |
SELECT tbldomainpricing.extension | |
FROM tbldomainpricing | |
WHERE id = tblpricing.relid | |
)"; | |
try { | |
$satement = mysql_query($query); | |
$domains = []; | |
while($row = mysql_fetch_assoc($satement)) { $domains[] = $row; } | |
$apiresults = ['result' => 'success', 'domain_pricing' => $domains]; | |
} catch (Exception $e){ | |
$apiresults = ['result' => 'error', 'message' => $e->getMessage()]; | |
echo json_encode($apiresults); | |
die(); | |
} | |
echo json_encode($apiresults); | |
die(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a simple script to get WHMCS domain pricing through the API