Dranzaz has asked for the wisdom of the Perl Monks concerning the following question:
With the Dumper tag, I get the following:$tempfileone = "/var/www/cgi-bin/logs/ipsectest/iptestscript$userips[$ +ipcontrol].txt"; $urlone = "http://notgivingthesite/cgi-bin/block-lookup\?$userips[$ipc +ontrol]"; $mechone = WWW::Mechanize->new(); print Dumper $mechone->get( $urlone, ':content_file' => $tempfileone ) +;
Again, from the command line everything works just fine. This snippet takes a given IP and places it in a reversed format (10.1.2.6 became 6.2.1.10) and then looks up the PTR record. It should then output to the browser the name lookup for the IP. Unfortunately it only returns a "could not get socket" error:$VAR1 = bless( { '_content' => '500 Can\'t connect to notgivingthesite +:80 (Bad hostname \'notgivingthesite\') ', '_rc' => 500, '_headers' => bless( { 'client-warning' => 'Internal +response', 'client-date' => 'Wed, 08 Apr +2009 13:34:36 GMT', 'content-type' => 'text/plain' }, 'HTTP::Headers' ), '_msg' => 'Can\'t connect to notgivingthesite:80 (Bad + hostname \'notgivingthesite\')', '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = +'http://notgivingthesite/cgi-bin/block-lookup?209.18.32.55')}, 'URI:: +http' ), '_headers' => bless( { 'user-a +gent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 'accept +-encoding' => 'gzip' }, 'HTTP: +:Headers' ), '_method' => 'GET', '_uri_canonical' => $VAR1->{'_ +request'}{'_uri'} }, 'HTTP::Request' ) }, 'HTTP::Response' ); $VAR1 = undef;
The resulting HTML output looks like the following:$ips = inet_aton("$userips[$ipcontrol]"); $forward = gethostbyaddr($ips, AF_INET); $reverselu = gethostbyname("$forward"); $reverse = inet_ntoa($reverselu) if ($reverselu); my $revIP = join(".", reverse(split(/\./, $userips[$ipcontrol]))); $|=1; print Dumper $query = $resolver->query("$revIP.in-addr.arpa.","PTR"); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "PTR"; print " ", $rr->ptrdname; $ptr = $rr->ptrdname; } print "<BR>"; } else { print " <STRONG><font color=\"red\">", $resolver->errorstring, "\n +"; $ptr = "NXDOMAIN"; print "</STRONG></font><BR>"; $testcondition = 1; } $|=0;
Again, from CLI works just fine and on the old server it works just fine. I beleive this to be an Apache issue since forcing the scripts to run via CLI works just fine. Can anyone assist in this? My server guy is stumped at this time and says Apache is setup correctly (ie near default config). Any assistance or guidance will be greatly appreciated. Thank You<STRONG><font color="red">could not get socket </STRONG></font><BR>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl?Apache issue on newly installed server
by almut (Canon) on Apr 08, 2009 at 14:34 UTC | |
by Dranzaz (Sexton) on Apr 08, 2009 at 15:03 UTC | |
Re: Perl?Apache issue on newly installed server
by cfreak (Chaplain) on Apr 08, 2009 at 14:17 UTC | |
by Dranzaz (Sexton) on Apr 08, 2009 at 14:28 UTC | |
Re: Perl?Apache issue on newly installed server
by Anonymous Monk on Apr 08, 2009 at 14:22 UTC |