Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert asp perlscript to clientside so that it totally runs without

Status
Not open for further replies.

Phalanx1

Programmer
Jul 21, 2003
128
US
this is the asp
<script language=&quot;perlscript&quot; runat=&quot;server&quot;>
use IO::Socket;
sub ErrorReport(){
$Response->Write(&quot;Cannot connect!&quot;);
$Response->end;
}

sub whois {
my ($domain, $server) = @_;
my $returnString=&quot;&quot;;

my $remote=new IO::Socket::INET(
Proto => &quot;tcp&quot;,
PeerAddr => &quot;$server&quot;,
PeerPort => &quot;whois(43)&quot;,
) or die ErrorReport;

$remote->autoflush(1);
print $remote &quot;$domain\n&quot; . $BLANK;
while ( <$remote> ) {
$returnString.=$_;
}
close $remote;
$returnString;
}

</script>
<%
domain=Request(&quot;domain&quot;)
if domain & &quot;&quot; = &quot;&quot; then
domain=&quot;enter-domain-here.com&quot;
end if
%>
<head>
<title>Whois Utility -- ASP and PerlScript!</title>
</head>
<body>
<h1>Whois Utility</h1>
<p>Use this page to look up a domain name in the internic database,
or any of the listed databases. Have fun!
<p>
<form action=&quot;inc-whois.asp&quot;>
<table>
<tr>
<td align=&quot;right&quot;>Enter domain to search for:</td>
<td><input name=&quot;domain&quot; type=&quot;text&quot; value=&quot;<% =domain %>&quot; size=&quot;25&quot;>&nbsp;&nbsp;
<input type=&quot;submit&quot; value=&quot;Look up domain&quot;></td>
</tr>
<tr>
<td align=&quot;right&quot;>Select a WHOIS database:</td>
<td><select name=&quot;db&quot; size=&quot;1&quot;>
<option value=&quot;rs.internic.net&quot; selected>The InterNIC
(rs.internic.net)
<option value=&quot;whois.arin.net&quot;>American Registry for Internet
Numbers (whois.arin.net)
<option value=&quot;whois.ripe.net&quot;>European IP Address Allocations
(whois.ripe.net)
<option value=&quot;whois.apnic.net&quot;>European IP Address Allocations
(whois.apnic.net)
<option value=&quot;whois.nic.mil&quot;>US Military (whois.nic.mil)
<option value=&quot;whois.nic.gov&quot;>US Government (whois.nic.gov)
</select></td>
</tr>
</table>
</form>
<%
if Request(&quot;domain&quot;) & &quot;&quot; <> &quot;&quot; then
strDomain=Request(&quot;domain&quot;)
strDB=Request(&quot;db&quot;)
strOutput=&quot;<br><br><hr><br><pre>&quot; & _
whois(strDomain,strDB) & &quot;</pre>&quot;
Response.Write strOutput
end if
%>
</body>
</html>
and this is what i got clientside so far...
<script language=&quot;perlscript&quot;>
use IO::Socket;
sub ErrorReport(){
$Window->document-getElementById(Response)->innerText(&quot;Cannot connect!&quot;);
}

sub whois {
my ($domain, $server) = @_;
my $returnString=&quot;&quot;;

my $remote=new IO::Socket::INET(
Proto => &quot;tcp&quot;,
PeerAddr => &quot;$server&quot;,
PeerPort => &quot;whois(43)&quot;,
) or die ErrorReport;

$remote->autoflush(1);
print $remote &quot;$domain\n&quot; . $BLANK;
while ( <$remote> ) {
$returnString.=$_;
}
close $remote;
$returnString;
}

</script>
<script language=&quot;vbscript&quot;>
Function SelectDomain()
if domain & &quot;&quot; = &quot;&quot; Then
domain=InputBox(&quot;enter-domain-here.com&quot;)
Else
Set domain = nothing
domain = document.domain.innerText
end If
End Function
</script>
<head>
<title>Whois Utility -- ASP and PerlScript!</title>
</head>
<body>
<h1>Whois Utility</h1>
<p>Use this page to look up a domain name in the internic database,
or any of the listed databases. Have fun!
<p>
<div id=&quot;Response&quot;></div>
<form action=&quot;return false;&quot; onsubmit=&quot;SelectDomain()&quot;>
<table>
<tr>
<td align=&quot;right&quot;>Enter domain to search for:</td>
<td><input name=&quot;domain&quot; type=&quot;text&quot; value=&quot;&quot; size=&quot;25&quot;>&nbsp;&nbsp;
<input id=&quot;GetDomain&quot; type=&quot;submit&quot; value=&quot;Look up domain&quot;></td>
</tr>
<tr>
<td align=&quot;right&quot;>Select a WHOIS database:</td>
<td><select name=&quot;db&quot; size=&quot;1&quot;>
<option value=&quot;rs.internic.net&quot; selected>The InterNIC
(rs.internic.net)
<option id=&quot;DF&quot; value=&quot;whois.arin.net&quot;>American Registry for Internet
Numbers (whois.arin.net)
<option id=&quot;DF1&quot; value=&quot;whois.ripe.net&quot;>European IP Address Allocations
(whois.ripe.net)
<option id=&quot;DF2&quot; value=&quot;whois.apnic.net&quot;>European IP Address Allocations
(whois.apnic.net)
<option id=&quot;DF3&quot; value=&quot;whois.nic.mil&quot;>US Military (whois.nic.mil)
<option id=&quot;DF4&quot; value=&quot;whois.nic.gov&quot;>US Government (whois.nic.gov)
</select></td>
</tr>
</table>
</form>
<script language=&quot;Perlscript&quot;>
if($window->GetDomain->click eq 1){
my $strDomain = $window->document->getElementById(domain)->innerText
my @strDB =&quot;needs help here though!!&quot;
$strOutput=&quot;<br><br><hr><br><pre>&quot; & whois($strDomain, %strDB) & &quot;</pre>&quot;l
$window->document->getElementById(Response)->innerText = strOutput;
}
</script>
</body>
</html>
 
You want us to convert your ASP code to perl?

It looks like the ASP code is running inline, that may give you trouble while you do this.

Can you be more specific in your question?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top