trying to use a proxy

Discussion in 'Perl Misc' started by Nospam, Aug 9, 2007.

  1. Nospam

    Nospam 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
    Nospam, Aug 9, 2007
    #1
    1. Advertising

  2. Nospam

    Guest

    On Aug 9, 4:05 pm, "Nospam" <> wrote:
    > 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=~%22fantastic+four%22&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

    >
    > with LWP::Debug qw(+) I receive
    >
    > LWP::UserAgent::new: () LWP::UserAgent::proxy: httphttp://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: GEThttp://news.google.co.uk/search?q=~%22fantastic+four%22&num=100&hl=en...
    > LWP::UserAgent::_need_proxy: Proxied tohttp://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
    , Aug 9, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vidy5300
    Replies:
    0
    Views:
    862
    vidy5300
    Jun 7, 2004
  2. Replies:
    0
    Views:
    1,640
  3. Karsten Wutzke
    Replies:
    1
    Views:
    876
    Steven Simpson
    Aug 20, 2007
  4. Klein Stéphane
    Replies:
    3
    Views:
    591
    Steve Holden
    Dec 20, 2009
  5. Alejandro Molina

    Proxy and non Proxy configurations

    Alejandro Molina, Jul 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    148
    Alejandro Molina
    Jul 15, 2004
Loading...

Share This Page