hi,
I have a problem connecting to the sites using LWP::UserAgent the code is working fine in command prompt but through cgi in browser it is giving an error:
500 cant connect to :80(unknown error)my code is here:
[CODE=perl]#!c:\perl\bin\p erl.exe
use CGI qw(:standard);
use LWP::UserAgent;
use CGI;
my $url="http://search.cpan.org/";
print header;
require LWP::UserAgent;
my $query=new CGI;
my $ua =LWP::UserAgent->new;
$ua->env_proxy();
$response=$ua->get($url);
$conn=$response->content;
print $conn;
my $res = $ua->request($conn) ;
#print start_html;
print<<HTML;
<title>info</title>
<body>
HTML
print $conn;
print "</html></body>";
if ($res->is_success)
{
print "success";
print "$conn";
#print $query->redirect("http ://first.server/index.php");
}
else
{
#print $query->redirect("http ://second.server/index.php");
}[/CODE]
Thankyou
I have a problem connecting to the sites using LWP::UserAgent the code is working fine in command prompt but through cgi in browser it is giving an error:
500 cant connect to :80(unknown error)my code is here:
[CODE=perl]#!c:\perl\bin\p erl.exe
use CGI qw(:standard);
use LWP::UserAgent;
use CGI;
my $url="http://search.cpan.org/";
print header;
require LWP::UserAgent;
my $query=new CGI;
my $ua =LWP::UserAgent->new;
$ua->env_proxy();
$response=$ua->get($url);
$conn=$response->content;
print $conn;
my $res = $ua->request($conn) ;
#print start_html;
print<<HTML;
<title>info</title>
<body>
HTML
print $conn;
print "</html></body>";
if ($res->is_success)
{
print "success";
print "$conn";
#print $query->redirect("http ://first.server/index.php");
}
else
{
#print $query->redirect("http ://second.server/index.php");
}[/CODE]
Thankyou
Comment