Hi monks, this is extremely urgent so please help me out if you know how... I have a script that register domain names for me. Currently, I have it setup for Enom registrar. It is using IO::Socket::INET. All the data like username, password, registration info are sent through http, port 80.

However, I am trying to modified it to work for another registrar. But that registrar is using https. Therefore, using port 80 won't work. Below is snippets of code for the Enom registrar, where it makes the connection then sends the data across.

new_reg { my ($domain) = @_; my ($domain_name, $tld) = split('\.', $domain); my %state;$state{'Command'} = 'Purchase'; $state{'tld'} = $tld; $state{'sld'} = $domain_name; $state{'responsetype'} = 'text'; $state{'NS1'} = $formdata{'ns1_host'}; $state{'NS2'} = $formdata{'ns2_host'}; $state{'NumYears'} = $formdata{'reg_period'}; $state{'RegistrantFirstName'} = $formdata{'reg_first_name'}; $state{'RegistrantLastName'} = $formdata{'reg_last_name'}; $state{'RegistrantAddress1'} = $formdata{'reg_address1'}; $state{'RegistrantCity'} = $formdata{'reg_city'}; $state{'RegistrantS +tateProvince'} = $formdata{'reg_state'}; $state{'RegistrantPostalCode'} = $formdata{'reg_zipcode'}; $state{'Reg +istrantPhone'} = $formdata{'reg_telephone'}; $state{'RegistrantCountr +y'} = $formdata{'reg_country'}; $state{'UID'} = $username; $state{'PW'} = $password; my $href = build_href($enom_start_url, %state); print("href = $enom_server , $href"); my $result; my $s = IO::Socket::INET->new(PeerAddr => "$enom_server:80") or return + undef; print $s "GET $href HTTP/1.0\n\n"; while (<$s>) { $result .= $_; } close($s); my $outfile = "regout-${domain}.html"; open (REGOUT, ">$outfile") or warn "couldnt write $outfile: $!\n"; print REGOUT "$result\n"; close REGOUT;

Basically, these are the form fields on the Enom domain name page. The data is stored in the text field name then sent across using http, port 80.

But I am trying to change it to support another registrar that uses https, port 443. But I have no luck at all in the getting it to work. Obviously, it won't work connecting using INET, so I modified it to SSL. Below is an example of the modificaiton to the connection part of the code.

my $s = new IO::Socket:SSL("$registrar:https") or die "Couldn't connec +t: err". &IO::Socket::SSL::errstr();
Besides the modified part above, I have edit the form field names and values for the new registrar API. I'm not sure if IO::Socket::SSL sends the data across like IO::Socket::INET.

But I left it alone. Below is an example of the modified fields for the new registrar API. These are the few textfields on the registrar registration page.

$state{'username'} = $username; $state{'password'} = $password;

Can anyone tell me why I can't seem to register a domain name with this setup at this registrar? What am I doing wrong? What needs to be done to get it to work on this registrar? Any help would be appreciated, thanks!


In reply to Problems with sending data over Socket SSL by onLOoker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.