Jump to content

Domain Pricing Table Data Feed - Specific TLD for 1-10 years


Recommended Posts

marieneige posted in the thread below asking how to create a data feed for a specific TLD that will show its registration prices for 1-10 years.




to keep things simple, the data feed will create a 2-column table, showing "Years" and "Register Price"... additionally, it will only show years for which you've set a register price.


to do this, create a new data feed file called domainpricingtld.php and add the following code...





<style type="text/css">
table.domainpricing {
   width: 600px;
   background-color: #ccc;
table.domainpricing th {
   padding: 3px;
   background-color: #efefef;
   font-weight: bold;
table.domainpricing td {
   padding: 3px;
   background-color: #fff;
   text-align: center;
<script language="javascript" src="feeds/domainpricingtld.php?currency=1"></script>


if (!is_numeric($currency))
       $currency = array();
       $currency = getCurrency('', $currency);

if (!$currency || !is_array($currency) || !isset($currency['id']))
       $currency = getCurrency();

$freeamt = formatCurrency(0);
$tldslist = getTLDList();
$selecttld = $_GET["domain"];
$tldpricing = getTLDPriceList($selecttld, true);
$years = range(1,10);

if (in_array($selecttld, $tldslist))
       $code = '<table cellspacing="1" cellpadding="0" class="domainpricing"><tr><th>Years</th><th>Register</th></tr>';
       foreach ($years AS $k)
           if ($tldpricing[$k]["register"]) 
                   $code .= sprintf(
                   htmlspecialchars($tldpricing[$k]["register"], ENT_QUOTES, 'UTF-8')

$code .= '</table>';

echo "document.write('".$code."');";

when you want to call the data feed, use the following code...


<script language="javascript" src="feeds/domainpricingtld.php?domain=.com"></script>

the above will show a table of your registration prices for .com


if you miss out the "domain=xxx" part, or use a tld that doesn't exist in your setup, the data feed will not display anything.


I haven't removed any of the currency code, so you should be able to specify the currency in the data feed URL too...


<script language="javascript" src="feeds/domainpricingtld.php?currency=2&domain=.com"></script>

with a few simple tweaks, you could use this as a basis for just showing transfer/renewal prices - or make it similar to the original feed and show all three (register/transfer/renewal).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated