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

monitor url wiht the help of proxy

Status
Not open for further replies.

amurarka

Programmer
Nov 13, 2011
3
0
0
pls tell me how to monitor url with the help of proxy in perl.
below code is not working plzzz corect it.

use warnings;
use strict;
use LWP::Simple qw($ua get);
$ua->proxy('http','acpwinggn2isa01a.aircel.co.in:80');
my $url = "my $webpage = get $url;

#my $url = get '
if (!$webpage) {

#open OUTPUT, ">>output.txt";
print "ERROR: Could not retrieve $url" ;
print scalar localtime(),"\n";
#close OUTPUT;

}
else {
#open OUTPUT, ">>output.txt";
print "no errors found ";
print scalar localtime(),"\n";
#close OUTPUT;

}

exit(0);
 
Not sure what it is you are trying to actually do.

If all you are trying to do is get a result or content, try this.

Code:
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;

my $proxy = '[URL unfurl="true"]http://proxyIP:Port/';[/URL]
my $contentget = '[URL unfurl="true"]http://www.google.com';[/URL]

my $ua = LWP::UserAgent->new;
$ua->timeout(5);
$ua->proxy(['http'], $proxy);

my $res = $ua->get($contentget);
if ($res->is_success) {
    print $res->decoded_content;
}
else {
    die $res->status_line;
}
 
thnks for ur reply

i am trying to monitor One url of our applicaiton throug OM tool for that we need perl script so plz help me


That url requires proxy server.

so i need one script to monitor this url
 
Can't locate object method "new" via package "LWP::UserAgent"


this eeror i am geitng
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top