<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
			<channel>
			<title>CentralNic Toolkit News</title>
			<link>http://toolkit.centralnic.com/index</link>
			<description>News and Updates for the CentralNic Toolkit system.</description>
			<generator>Project Steve Guttenberg v1.13.0 (http://www.projectsteveguttenberg.org/)</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs><language>en-gb</language><image><url>http://toolkit.centralnic.com/images/logo.png</url><title>CentralNic Toolkit News</title><link>http://toolkit.centralnic.com/index</link></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/CentralNicToolkitNews" type="application/rss+xml" /><item>
					<title>Sample Code: how to automatically prepare a payment batch</title>
					<description>Here's some sample code showing what you can do with our WWW::CN...</description>
					<link>http://feedproxy.google.com/~r/CentralNicToolkitNews/~3/F9gnO-oGfwY/k06q6x.html</link>
					<comments>http://toolkit.centralnic.com/index/article/k06q6x.html#comments</comments>
					<guid isPermaLink="false">http://toolkit.centralnic.com/index/article/k06q6x.html</guid>
					<pubDate>Thu, 01 May 2008 11:23:21 +0100</pubDate><dc:creator>Gavin Brown</dc:creator><category /><content:encoded><![CDATA[<p>Here's some sample code showing what you can do with our <a href="http://toolkit.centralnic.com/lib/perl">WWW::CNic</a> Perl library. This script uses two functions &mdash; <a href="http://toolkit.centralnic.com/doc/list_outstanding_domains">list_outstanding_domains</a> and <a href="http://toolkit.centralnic.com/doc/submit_payment_batch">submit_payment_batch</a> &mdash; to automatically prepare a payment batch for all domain names that are 45 days or more overdue.</>

<p>There are a few ways this script could be customised: for example, to send an email to your finance team to instruct them to initiate a wire transfer for the payment. In a production environment, you'd also want to log what you're doing and update the status of the domain names in your own database.</p>

<p>We hope to be able to publish more sample scripts in the future: watch this space!</p>

<pre>
<i><span style="color: #B22222">#!/usr/bin/perl -w
</span></i><i><span style="color: #B22222"># example script to automatically remit payment advice for oustanding
</span></i><i><span style="color: #B22222"># domain names.
</span></i><i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># Copyright (c) 2008 CentralNic Ltd. All rights reserved. This program is
</span></i><i><span style="color: #B22222"># free software; you can redistribute it and/or modify it under the same
</span></i><i><span style="color: #B22222"># terms as Perl itself.
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">use</span></b> WWW::CNic;
<b><span style="color: #A020F0">use</span></b> Date::Manip;
<b><span style="color: #A020F0">use</span></b> strict;
<b><span style="color: #A020F0">use</span></b> warnings;

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># some basic variables:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">my</span></b> $registrar_id         = <b><span style="color: #BC8F8F">''</span></b>;       <i><span style="color: #B22222"># your registrar ID
</span></i><b><span style="color: #A020F0">my</span></b> $password             = <b><span style="color: #BC8F8F">''</span></b>;       <i><span style="color: #B22222"># your registrar password (or toolkit password)
</span></i><b><span style="color: #A020F0">my</span></b> $days                 = 45;       <i><span style="color: #B22222"># threshold after which you want to remit payment for a domain
</span></i><b><span style="color: #A020F0">my</span></b> $method               = <b><span style="color: #BC8F8F">'BA'</span></b>;     <i><span style="color: #B22222"># BA for a bank transfer, or CH for a check
</span></i>
<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># prepare the query to return all outstanding domains:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">my</span></b> $query = WWW::CNic-&gt;new(
        use_ssl         =&gt; 1,
        command         =&gt; <b><span style="color: #BC8F8F">'list_outstanding_domains'</span></b>,
        username        =&gt; $registrar_id,
        password        =&gt; $password,
);

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># execute the query and check the response for an error:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">my</span></b> $result = $query-&gt;execute;

<b><span style="color: #A020F0">if</span></b> ($result-&gt;is_error) {
        <b><span style="color: #A020F0">printf</span></b>(
                STDERR
                <b><span style="color: #BC8F8F">"Error retrieving outstanding domains list: %s\n"</span></b>,
                $result-&gt;message
        );
        <b><span style="color: #A020F0">exit</span></b> 1;
}

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># the domains to be paid off go in here:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">my</span></b> @domains;

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># loop through the result:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">foreach</span></b> <b><span style="color: #A020F0">my</span></b> $domain ($result-&gt;domains) {
     <i><span style="color: #B22222">#
</span></i>     <i><span style="color: #B22222"># calculate how long the domain has been unpaid:
</span></i>     <i><span style="color: #B22222">#
</span></i>     <b><span style="color: #A020F0">my</span></b> $outstanding = <b><span style="color: #A020F0">int</span></b>((<b><span style="color: #A020F0">time</span></b>() - strtotime($domain-&gt;{expiry})) / 86400);

     <i><span style="color: #B22222">#
</span></i>     <i><span style="color: #B22222"># if the 'batch' property is non-zero, then we've already
</span></i>     <i><span style="color: #B22222"># processed this domain, so ignore it:
</span></i>     <i><span style="color: #B22222">#
</span></i>     <b><span style="color: #A020F0">next</span></b> <b><span style="color: #A020F0">if</span></b> (<b><span style="color: #A020F0">defined</span></b>($domain-&gt;{batch}) &amp;&amp; <b><span style="color: #A020F0">int</span></b>($domain-&gt;{batch}) &gt; 0);

     <i><span style="color: #B22222">#
</span></i>     <i><span style="color: #B22222"># if the domain is above the threshold, add it to the list:
</span></i>     <i><span style="color: #B22222">#
</span></i>     <b><span style="color: #A020F0">if</span></b> ($outstanding &gt;= $days) {
                <b><span style="color: #A020F0">printf</span></b>(
                        <b><span style="color: #BC8F8F">"Adding domain '%s' to batch, as it is %d days outstanding\n"</span></b>,
                        $domain-&gt;{domain},
                        $outstanding
                );
                <b><span style="color: #A020F0">push</span></b>(@domains, $domain-&gt;{domain});
        }
}

<b><span style="color: #A020F0">if</span></b> (0 == <b><span style="color: #A020F0">scalar</span></b>(@domains)) {
        <b><span style="color: #A020F0">print</span></b> <b><span style="color: #BC8F8F">"No domains found, exiting normally.\n"</span></b>;
        <b><span style="color: #A020F0">exit</span></b> 0;
}

<b><span style="color: #A020F0">printf</span></b>(<b><span style="color: #BC8F8F">"Submit payment advice for %d domains\n"</span></b>, <b><span style="color: #A020F0">scalar</span></b>(@domains));

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># prepare the query to submit payment advice:
</span></i><i><span style="color: #B22222">#
</span></i>$query = WWW::CNic-&gt;new(
        use_ssl         =&gt; 1,
        command         =&gt; <b><span style="color: #BC8F8F">'submit_payment_batch'</span></b>,
        username        =&gt; $registrar_id,
        password        =&gt; $password,
);

$query-&gt;set(<b><span style="color: #BC8F8F">'method'</span></b>, $method);
$query-&gt;set(<b><span style="color: #BC8F8F">'domains'</span></b>, \@domains);

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># execute the query and check the response for an error:
</span></i><i><span style="color: #B22222">#
</span></i>$result = $query-&gt;execute;

<b><span style="color: #A020F0">if</span></b> ($result-&gt;is_error) {
        <b><span style="color: #A020F0">printf</span></b>(
                STDERR
                <b><span style="color: #BC8F8F">"Error submitting payment batch: %s\n"</span></b>,
                $result-&gt;message
        );
        <b><span style="color: #A020F0">exit</span></b> 1;
}

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># display response info:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">printf</span></b>(
        <b><span style="color: #BC8F8F">"Payment Batch #%d created for %d items at %s%01.2f (plus %s%01.2f VAT)\n"</span></b>,
        $result-&gt;response(<b><span style="color: #BC8F8F">'batch'</span></b>),
        $result-&gt;response(<b><span style="color: #BC8F8F">'items'</span></b>),
        $result-&gt;response(<b><span style="color: #BC8F8F">'currency'</span></b>),
        $result-&gt;response(<b><span style="color: #BC8F8F">'amount'</span></b>),
        $result-&gt;response(<b><span style="color: #BC8F8F">'currency'</span></b>),
        $result-&gt;response(<b><span style="color: #BC8F8F">'vat'</span></b>),
);

<i><span style="color: #B22222">#
</span></i><i><span style="color: #B22222"># a PHP-like strtotime() function:
</span></i><i><span style="color: #B22222">#
</span></i><b><span style="color: #A020F0">sub</span></b> strtotime { UnixDate(ParseDate($_[0]), <b><span style="color: #BC8F8F">'%s'</span></b>) }
</pre><img src="http://feeds.feedburner.com/~r/CentralNicToolkitNews/~4/F9gnO-oGfwY" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://toolkit.centralnic.com/index/article/k06q6x.html</feedburner:origLink></item><item>
					<title>New functions and libraries</title>
					<description>We've finally gotten round to making our web forwarding system a...</description>
					<link>http://feedproxy.google.com/~r/CentralNicToolkitNews/~3/GBiAFvA0IwM/jvs3pl.html</link>
					<comments>http://toolkit.centralnic.com/index/article/jvs3pl.html#comments</comments>
					<guid isPermaLink="false">http://toolkit.centralnic.com/index/article/jvs3pl.html</guid>
					<pubDate>Tue, 05 Feb 2008 18:36:57 +0000</pubDate><dc:creator>Gavin Brown</dc:creator><category /><content:encoded><![CDATA[<p>We've finally gotten round to making our web forwarding system available to users of the Toolkit. This system allows you to specify a URL to which a domain name will be forwarded, rather than being delegated to DNS servers.</p>

<p>Details of the new function can be found on the documentation pages for the <a href="http://toolkit.centralnic.com/doc/register"><tt>register</tt></a> and <a href="http://toolkit.centralnic.com/doc/modify"><tt>modify</tt></a> functions, and you can also see usage information in the documentation for the <a href="https://toolkit.centralnic.com/lib/perl?module=WWW::CNic::Cookbook#registering_a_domain_name">Perl</a> and <a href="https://toolkit.centralnic.com/lib/php?class=CNic_Toolkit_Cookbook#registering_a_domain">PHP</a> libraries, which have been updated today. You can download the latest releases from the <a href="http://toolkit.centralnic.com/downloads">downloads</a> page.</p><img src="http://feeds.feedburner.com/~r/CentralNicToolkitNews/~4/GBiAFvA0IwM" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://toolkit.centralnic.com/index/article/jvs3pl.html</feedburner:origLink></item><item>
					<title>WWW::CNic 0.24</title>
					<description>A new version of WWW::CNic is now available from the downloads p...</description>
					<link>http://feedproxy.google.com/~r/CentralNicToolkitNews/~3/wrxOEcikYXI/jlolpp.html</link>
					<comments>http://toolkit.centralnic.com/index/article/jlolpp.html#comments</comments>
					<guid isPermaLink="false">http://toolkit.centralnic.com/index/article/jlolpp.html</guid>
					<pubDate>Tue, 24 Jul 2007 12:39:25 +0100</pubDate><dc:creator>Gavin Brown</dc:creator><category /><content:encoded><![CDATA[<p>A new version of <a href="http://toolkit.centralnic.com/lib/perl">WWW::CNic</a> is now available from the <a href="http://toolkit.centralnic.com/downloads">downloads page</a>. This release corrects an issue with the period parameter of the <tt>issue_renewals</tt> command.</p><img src="http://feeds.feedburner.com/~r/CentralNicToolkitNews/~4/wrxOEcikYXI" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://toolkit.centralnic.com/index/article/jlolpp.html</feedburner:origLink></item><item>
					<title>New Account Management Functions</title>
					<description>We have just enabled two new Toolkit functions that we think wil...</description>
					<link>http://feedproxy.google.com/~r/CentralNicToolkitNews/~3/6ACyPqBH9SU/jkx821.html</link>
					<comments>http://toolkit.centralnic.com/index/article/jkx821.html#comments</comments>
					<guid isPermaLink="false">http://toolkit.centralnic.com/index/article/jkx821.html</guid>
					<pubDate>Mon, 09 Jul 2007 17:49:13 +0100</pubDate><dc:creator>Gavin Brown</dc:creator><category /><content:encoded><![CDATA[<p>We have just enabled two new Toolkit functions that we think will be of great interest to our registrars:</p>

<ul>
<li>The <a href="http://toolkit.centralnic.com/doc/list_outstanding_domains">list_outstanding_domains</a> allows you to retrieve a list of all outstanding invoice items for unpaid registrations and renewals</li>
<li>The <a href="http://toolkit.centralnic.com/doc/submit_payment_batch">submit_payment_batch</a> function allows you to create a payment batch of outstanding domain items and notify us tha you're planning to remit payment via bank transfer or cheque</li>
</ul>

<p>The upshot of this is that it is now possible for registrars to automate the process of keeping their account up-to-date, minimising the amount of human intervention.</p>

<p>These new functions are also available via the <a href="http://toolkit.centralnic.com/lib/perl?module=WWW::CNic::Cookbook">Perl</a> and <a href="http://toolkit.centralnic.com/lib/php?class=CNic_Toolkit_Cookbook">PHP</a> libraries - consult the relevant cookbook for more information. The relevant releases of these libraries (0.23 for Perl and 0.0.23 for PHP) are available from the <a href="http://toolkit.centralnic.com/downloads">downloads</a> page.</p>

<p>Finally, these functions are also available to EPP-based registrars who ordinarily cannot access Toolkit functions.</p><img src="http://feeds.feedburner.com/~r/CentralNicToolkitNews/~4/6ACyPqBH9SU" height="1" width="1"/>]]></content:encoded><feedburner:origLink>http://toolkit.centralnic.com/index/article/jkx821.html</feedburner:origLink></item></channel></rss>
