trying to use a proxy

G

Guest

I am trying to use a proxy the same proxy works fine in ie6/firefox but for
some strange reason I get an uninitialised value when using the proxy in ANY
perl script, the code to use the proxy is:

use strict;
use warnings;
use LWP::Debug qw(+);
use WWW::Mechanize;

my $mech = WWW::Mechanize->new();

my $url =
http://news.google.co.uk/search?q=~...0&hl=en&safe=off&start=0&as_qdr=all&filter=0;


$mech->proxy('http','http://127.0.0.1:8088');

$mech->get($url);

my @links_to_check = grep { $_->url() !~ /google/i}
$mech->find_all_links( url_regex => qr/\./i );





foreach my $links_to_check (@links_to_check)
{

print "$links_to_check \n";

}

with LWP::Debug qw(+) I receive

LWP::UserAgent::new: () LWP::UserAgent::proxy: http http://127.0.0.1:8088
LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking
news.google.co.uk for cookies HTTP::Cookies::add_cookie_header: Checking
..google.co.uk for cookies HTTP::Cookies::add_cookie_header: Checking
google.co.uk for cookies HTTP::Cookies::add_cookie_header: Checking .co.uk
for cookies HTTP::Cookies::add_cookie_header: Checking co.uk for cookies
HTTP::Cookies::add_cookie_header: Checking .uk for cookies
LWP::UserAgent::send_request: GET
http://news.google.co.uk/search?q=~...00&hl=en&safe=off&start=0&as_qdr=all&filter=0
LWP::UserAgent::_need_proxy: Proxied to http://127.0.0.1:8088
LWP::protocol::http::request: () LWP::protocol::collect: read 130 bytes
LWP::UserAgent::request: Simple response: Not Found Use of uninitialized
value in concatenation (.) or string at movien1.pl line 28. 0 news items
found
 
H

himanshu.garg

I am trying to use a proxy the same proxy works fine in ie6/firefox but for
some strange reason I get an uninitialised value when using the proxy in ANY
perl script, the code to use the proxy is:

use strict;
use warnings;
use LWP::Debug qw(+);
use WWW::Mechanize;

my $mech = WWW::Mechanize->new();

my $url =http://news.google.co.uk/search?q=~"fantastic+four"&num=100&hl=en...

$mech->proxy('http','http://127.0.0.1:8088');

$mech->get($url);

my @links_to_check = grep { $_->url() !~ /google/i}
$mech->find_all_links( url_regex => qr/\./i );

foreach my $links_to_check (@links_to_check)
{

print "$links_to_check \n";

}

Strange,

but the script works for me with my proxy settings.

:(
HG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top