j99 has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks!
I am looking for a solution how to do a HTTP get request to a IP (let's say 192.168.0.100), port 80 by specifying virtual host that does not exist (non existing domain)! I am connecting to servers that have multiple vhosts defined on single IP but these vhosts are internal (e.g. server1, server2 etc.). If I enter IP and host into hosts file it works just by getting http://server1/ etc. but I need to run my script also on servers where I can not modify hosts file.
Somebody already suggested to me that I should try to specify server's IP address as proxy in LWP::UserAgent request like:
my $ua = LWP::UserAgent->new; $ua->proxy('http','http://192.168.0.100:80/'); my $response = $ua->get('http://server1/');
but this doesn't work (it returns 500 Can't connect to 192.168.0.100:80 (connect: No route to host))
Can someone suggest how this could be done without the need to modify /etc/hosts file? Thanx!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get data via HTTP on IP and specify virtual host
by tobyink (Canon) on Feb 28, 2012 at 21:25 UTC | |
|
Re: Get data via HTTP on IP and specify virtual host
by Anonymous Monk on Feb 28, 2012 at 18:51 UTC | |
by locked_user sundialsvc4 (Abbot) on Feb 28, 2012 at 20:16 UTC | |
by Corion (Patriarch) on Feb 28, 2012 at 20:39 UTC | |
by bitingduck (Deacon) on Feb 29, 2012 at 03:44 UTC | |
by Corion (Patriarch) on Feb 29, 2012 at 09:08 UTC |