473,834 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Perl LWP content request behind firewall and proxy server

Hi,
I am trying to fetch a web content using LWP and HTTP modules behind
corp firewall. I set proxy server as shown in my internet explorer
connection setup.
When i run the script, i got successful response, but the return
content is not the webpage i requested at all. It shows something
like:
-------------------------------------------------
function FindProxyForURL (url,host) {
me=myIpAddress( );
if (me == "127.0.0.1" ) {return "DIRECT";}
if (host == "127.0.0.1" ) {return "DIRECT";}
if (host == "localhost" ) {return "DIRECT";}
if (isPlainHostNam e(host)) {return "DIRECT";}
..
..
..
---------------------------------------------------

Below is my sample script:
require LWP::UserAgent;
require HTTP::Request;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->proxy(['http', 'ftp'], 'http://autoproxy:9090' );

my $request = HTTP::Request->new(POST => 'http://www.google.com' );
my $response = $ua->request($reque st);
if ($response->is_success) {
print $response->content; # or whatever
}
else {
die $response->status_line;
}

Anyone can help me on this? will appreciate.

by,
demon hunter
Jul 19 '05 #1
3 11842
demonhunter wrote:
I am trying to fetch a web content using LWP and HTTP modules
behind corp firewall.
<snip>
my $request = HTTP::Request->new(POST => 'http://www.google.com' );

------------------------------------^^^^

A POST request to get a web page?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Jul 19 '05 #2
Gunnar Hjalmarsson <no*****@gunnar .cc> wrote in message news:<yU******* ********@newsb. telia.net>...
demonhunter wrote:
I am trying to fetch a web content using LWP and HTTP modules
behind corp firewall.


<snip>
my $request = HTTP::Request->new(POST => 'http://www.google.com' );

------------------------------------^^^^

A POST request to get a web page?


Oh, that suppose to be a GET, i did some changes here and there when
it doesnt work in GET. And it gave me the same
"FindProxyForUR L(url,host)" content. Any idea why?
Jul 19 '05 #3
de**********@ho tmail.com (demonhunter) wrote in message news:<b3******* *************** ****@posting.go ogle.com>...
I am trying to fetch a web content using LWP and HTTP modules behind
corp firewall. I set proxy server as shown in my internet explorer
connection setup. $ua->proxy(['http', 'ftp'], 'http://autoproxy:9090' ); When i run the script, i got successful response, but the return
content is not the webpage i requested at all. It shows something
like:
-------------------------------------------------
function FindProxyForURL (url,host) {
me=myIpAddress( );
if (me == "127.0.0.1" ) {return "DIRECT";}
if (host == "127.0.0.1" ) {return "DIRECT";}
if (host == "localhost" ) {return "DIRECT";}
if (isPlainHostNam e(host)) {return "DIRECT";}
.
.
.
---------------------------------------------------


Go back and look at the internet explorer connection setup again.

Where did you see 'http://autoproxy:9090' ?

I suspect it was not the address of the proxy. I suspect was the URL
of the proxy autoconfigurati on script. I further suppose that tje
HTTP server at autoproxy:9090 is very simplistic and just returns the
PAC in response to all GET requests.

AFAIK LWP doesn't understand PACs (because it would require a full
JavaScript subsystem). (Actually there are people working on
JavaScript for LWP so one day soon there may be PAC support).

To figure out the address of the proxy examine the PAC yourself and
look for a line that says:

return "PROXY host:port";

This newsgroup does not exist (see FAQ). Please do not start threads
here.
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2060
by: rk | last post by:
Hi, I'm trying to write a cgi/perl programs to post a report like the following format in which the the user has to feed the values(nos) in the boxes under % Done Qual Rel. Stab P1 p2 P3.... and boxes under
5
980
by: Bill Hauver | last post by:
I am attempting to use a web service from my work pc which is behind a firewall. I have used wsdl.exe to create the web service reference class and added it to my project. (this seems to work without a hitch). Before I use this class, I make the necessary calls to instantiate a WebProxy class and then pass in my credentials to set the WebProxy.Credentials property so I can get through the proxy server.
2
5716
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2 webbrowser controls on it. Besides that i'm using the firewall client for isa server 2004 and it seems that the browsers aren't able to pass thru it... if i disable the firewall the browsers work fine, if i don't, the 2 browsers just stay there...
1
6582
by: JTrigger | last post by:
I need to call a .Net web service that takes an array or object as a parameter from a PERL client. I have been trying to use the PERL SOAP::Lite package to do this without success. I can call one that takes a simple type, such as int or string, but not an array or object. Please help!!! My code that I have written to call the web service and the SOAP packets that get sent and received are below. It seems like no matter what I do I...
2
3051
by: sameer | last post by:
hi all, Description of my .net application: Desktop application using webservices over the internet to communicate with the sql server2000 database which is sitting behind the webserver. Done in VS2003 using VB.net on framework 1.1, Database is sql server 2000 Application works perfectectly ok and no problems at all even if there is a firewall in between. Question is would my application have any problems if it is calling the
6
2169
by: John | last post by:
Hi My app is running on a windows 2000 server with isa 2000 installed. How can it access an external sql server (using its ip) from within the isa 2000 firewall/proxy via code? Thanks Regards
22
2956
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the server-side and then presented to the browser, with Javascript and CSS being used to vary the...
10
6986
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
0
9800
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9651
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10516
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9339
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5629
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5800
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3987
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.