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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PERL http/lwp error behind firewall

Status
Not open for further replies.

mohankumarg

Technical User
Joined
Apr 12, 2007
Messages
1
Location
US
Hi All,

My standalone PERL script that need to connect to web using HTTP & LWP, throws the error "500 Can't connect to (Bad hostname '
The program works fine when I access intranet web pages.

require HTTP::Request;
require LWP::UserAgent;
require HTTP::Headers;

$h = HTTP::Headers->new;
$h->proxy_authorization_basic("user1", "pass123");
$request = HTTP::Request->new('GET', ' $h);
# $request = HTTP::Request->new('GET', '
print "Created connection: $request", "\n";

$ua = LWP::UserAgent->new;
$response = $ua->request($request);
print "Sent request: ", $response->is_success, "\n";

if ($response->is_success) {
$content = $response->content;
}
else {
$content = 'Error occured';
print STDERR $response->status_line, "\n";
}

When I browse any internet websites through browser, the firewall displays the authentication popup. I can access the websites only after entering the valid network id and password in popup.

Any solution to this problem?
 
mohankumarq said:
When I browse any internet websites through browser, the firewall displays the authentication popup. I can access the websites only after entering the valid network id and password in popup

One thing that you might not know about is that you can include the user/pass in the actual url string.

[ignore][/ignore]

However, your problem connecting to google probably centers around the fact that you're not specifying a user agent.

- Miller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top