onLOoker has asked for the wisdom of the Perl Monks concerning the following question:
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.
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.my $s = new IO::Socket:SSL("$registrar:https") or die "Couldn't connec +t: err". &IO::Socket::SSL::errstr();
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with sending data over Socket SSL
by tachyon (Chancellor) on Feb 28, 2004 at 11:08 UTC | |
by Hero Zzyzzx (Curate) on Feb 28, 2004 at 16:41 UTC | |
by Anonymous Monk on Feb 28, 2004 at 18:25 UTC | |
by esskar (Deacon) on Feb 28, 2004 at 18:32 UTC | |
by Anonymous Monk on Feb 28, 2004 at 23:35 UTC | |
| |
|
Re: Problems with sending data over Socket SSL
by matija (Priest) on Feb 28, 2004 at 08:15 UTC |