this should work:

root@depression/# ./f.pl f
Renewal for foo.com succeded!
Renewal for bar.com failed: Domain not found
Renewal for blah.com failed: Domain not found

#!/usr/bin/perl
# read a file and renew every domain in it. for chuckie!

BEGIN {
    do "/path/to/OpenSRS.conf";
}

#set renewal length
my $no_years = 1;

if ( $ARGV[0] eq "" ) {
        print STDOUT "usage: $0 <filename>\n";
        exit;
}

use strict;
use lib $PATH_LIB;
use OpenSRS::XML_Client qw(:default);
my $XML_Client;
$XML_Client = new OpenSRS::XML_Client(%OPENSRS);
$XML_Client->login;
chomp(my $file = $ARGV[0]);

my $domain;
open(FILE, $file) or die "couldn't open file: $file\n";
foreach (<FILE>) {
        chomp($domain = $_);
        my $xcp_req = {
                action   => 'renew',
                object   => 'domain',
                login    => 'xxxxxxx',
                password => 'xxxxxxx',
                attributes => {
                        domain => "$domain",
                        currentexpirationyear => "2001",
                        period => "$no_years",
                        auto_renew => "off",
                }
        };

        my $res = $XML_Client->send_cmd( $xcp_req );
        my $response = $res->{ response_text };

        if (not $res->{is_success}) {
                print "Renewal for $domain failed: $response\n";
        } else {
                print "Renewal for $domain succeded!\n";
        }

}

$XML_Client->logout;


Thanks,
Ross Mueller

-> OSS
-> tcsh is the turkey shell

On Fri, 22 Jun 2001, Charles Daminato wrote:

> Well, I'm no programmer, BUT you could do something with it...
> 
> Say, make an array of @domain and @no_years, then for each element in the
> array extract $domain[x], $no_year[x] (I don't even know if my syntax is
> correct!), and pass that through the "send_cmd" part (maybe even loop the
> "sending command to server for $domain, $no_years")
> 
> Wouldn't take too much to modify, be sure you *cough* test it first!
> 
> Assuming you know Perl, but I'm sure some smart-dude on this list could whip
> it up in about 5 minutes (most of the beef is already there).
> 
> I *could* get it done, but it would take me a couple of hours trouble
> shooting, referring to a Perl book for arrays (I'm horrible with arrays, I
> just don't know why), and testing it a few times.  Can you wait until I have
> some spare time, say... August? ;)
> 
> Charles Daminato
> OpenSRS Product Manager
> Tucows Inc. - [EMAIL PROTECTED]
> 
> > -----Original Message-----
> > From: Alex Brecher [mailto:[EMAIL PROTECTED]]
> > Sent: June 22, 2001 3:34 PM
> > To: Charles Daminato; [EMAIL PROTECTED]
> > Subject: Re: Renewal Script
> >
> >
> > Thank you for the script! That script is not really what we
> > needed since it does renewals one at a time. Can it be edited to do bulk
> > renewals ?
> >
> > Best Regards,
> >
> > Alex Brecher
> >
> > Visit us at http://www.Successfulhosting.com
> > We'll make your web site a success!
> >
> > Get your own domain name for only $14.99
> > http://www.DiscountDomainRegistry.com
> >
> > *****PLEASE DO NOT DELETE ANY PART OF THIS MESSAGE WHEN REPLYING*****
> > ----- Original Message -----
> > From: "Charles Daminato" <[EMAIL PROTECTED]>
> > To: "Alex Brecher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Friday, June 22, 2001 2:51 PM
> > Subject: RE: Renewal Script
> >
> >
> > > (Thank you William X. Walsh)
> > >
> > > http://www.userfriendly.com/renew.txt
> > >
> > > Modify as you see fit, caveat emptor - you don't need profile
> > info, just the
> > > domain and your own Reseller account (and adequate funds, of course)
> > >
> > > Charles Daminato
> > > OpenSRS Product Manager
> > > Tucows Inc. - [EMAIL PROTECTED]
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > > > Behalf Of Alex Brecher
> > > > Sent: June 22, 2001 2:23 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Renewal Script
> > > > Importance: High
> > > >
> > > >
> > > > We need to have a script TODAY that will allow us to enter a
> > > > large amount of domains into a form to renew many domains at once. The
> > > > script will not need any credit card integration, we just need it
> > > > for our own bulk renewal purposes. If you have a script like this
> > > > that you can share or if you can write this script today please
> > > > contact us ASAP!
> > > >
> > > > Best Regards,
> > > >
> > > > Alex Brecher
> > > >
> > > > Visit us at http://www.Successfulhosting.com
> > > > We'll make your web site a success!
> > > >
> > > > Get your own domain name for only $14.99
> > > > http://www.DiscountDomainRegistry.com
> > > >
> > > > *****PLEASE DO NOT DELETE ANY PART OF THIS MESSAGE WHEN REPLYING*****
> > > >
> > >
> >
> 


Reply via email to