For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > August 2005 > trouble with get function and proxy









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author trouble with get function and proxy
ver_for@yahoo.it

2005-08-29, 6:59 pm

Hi,

I use the get() function to get the content of web pages and it used to
work.

get("http://www.goggle.com")

Now the configuration of the network has changed, with the use of a
proxy to access the internet and now i do not get the results.

How should do?

The IP of the proxy is something like 255.255.255.254 and the port is
3615.

Thanks in advance for your answers,

Ver_for

Brian Wakem

2005-08-29, 6:59 pm

ver_for@yahoo.it wrote:

> Hi,
>
> I use the get() function to get the content of web pages and it used to
> work.
>
> get("http://www.goggle.com")
>
> Now the configuration of the network has changed, with the use of a
> proxy to access the internet and now i do not get the results.
>
> How should do?
>
> The IP of the proxy is something like 255.255.255.254 and the port is
> 3615.
>
> Thanks in advance for your answers,
>
> Ver_for



www.google.com

Results 1 - 10 of about 80,600 for lwp proxy. (0.26 seconds)


--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
ver_for@yahoo.it

2005-08-31, 6:57 pm

I have found two solutions that work.
1 - modifying the configuration of the OS

Under Windows NT or XP
Right click on "My Computer", click on "properties", select the
"environment" tab. These are your environment settings. Make the
following changes:

1. Add the setting HTTP_proxy, with your proxy name as the value
(you must include "http://" ), followed by a colon and the proxy port,
if applicable; e.g., "http://proxy:8080"
2. Add the setting HTTP_proxy_user, with your user name as the
value
3. Add the setting HTTP_proxy_pass, with your password as the
value

Under Windows 95
In your AUTOEXEC.BAT file, place the following lines then reboot so
the changes can take effect:

3. SET HTTP_proxy=<your proxy server (you must include "http://"
>, followed by a colon and the proxy port, if applicable; e.g., SET HTTP_proxy=http://proxy:8080

4. SET HTTP_proxy_user=<your user name>
5. SET HTTP_proxy_pass=<your password>

2 - modifying the script perl

use LWP::Simple;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
$ua->proxy( 'http', 'http://255.255.255.255:3615/');

my $req = HTTP::Request->new( GET => 'http://www.google.com/' );
my $res = $ua->request($req);
my $page = $res->content();

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com