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

libLWP - useragent->proxy not set

Status
Not open for further replies.

teodor

Technical User
May 16, 2002
3
RO
Hello,

I have perl 5.6.1 built for Cygwin on WinME. I have a local LAN, connected to Internet through a proxy, and I want to run the following script:

use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->proxy(http => `192.168.0.1:8081`);
$req = HTTP::Request->new(GET, "$resp = $ua->request($req);
$expl = $resp->error_as_HTML();
print($expl);

I get the error:
<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</H1>
500 Can't connect to (Bad hostname '</BODY>
</HTML>

Please help,

Teodor
 
Teodor,

Can you use your web browser on that machine to get to ? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
hi mike,

yes, i can see it, my browser (internet explorer) works just fine.

Thank you,
teodor
 
Teodor,

I've never done this, but your code looks a little different to the example in the UserAgent documentation.

$ua->proxy(['http', 'ftp'], ' $ua->proxy('gopher', '
From this example I would have thought you needed to say:

$ua->proxy('http','
(also, in your code you were using ` to quote the IP address rather than ')

Have a good Christmas/Holiday - I'm outa here :) Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top