Problem with LWP::USERAGENT

Discussion in 'Perl' started by Chandra, Feb 25, 2004.

  1. Chandra

    Chandra Guest

    Hello gurus,
    I am using LWP::Useragent perl module to get a url from the
    www.
    Code snippet:

    #!perl -w

    use LWP::UserAgent;
    LWP::Debug::level('+');
    $ua = new LWP::UserAgent || die "$!";
    $ua->proxy(['http', 'ftp'] => 'http://server/proxyname');

    $req = new HTTP::Request 'GET',"http://www.perl.com/" || die "$!";
    $ua->agent('Mozilla/4.03');
    $req->proxy_authorization_basic("username", "password");
    $res = $ua->request($req) || die "$!";
    if ($res->is_success)
    { print $res->content }
    else
    { print $res->error_as_HTML }


    This seems to work indifferently . Becuase every time i run this it
    print a page with my proxy server name etc.

    RESULT:
    <HTML>
    <HEAD>
    <TITLE>internetgateway on servername</TITLE>
    </HEAD>
    <BODY>

    <CENTER>
    iPlanet 6.04 "internetgateway" instance on machinename
    </CENTER>

    </BODY>
    </HTML>


    Can any body please help me with this .
    Thanks in advance
    -Shekhar
     
    Chandra, Feb 25, 2004
    #1
    1. Advertisements

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. Playker
    Replies:
    0
    Views:
    541
    Playker
    Feb 24, 2005
  2. Gaurav

    Problem using LWP::UserAgent

    Gaurav, Oct 2, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    265
    Tad McClellan
    Oct 2, 2003
  3. unreal

    LWP::UserAgent & threads problem

    unreal, Apr 30, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    115
    unreal
    Apr 30, 2004
  4. RP
    Replies:
    6
    Views:
    404
    Matt Garrish
    Jun 5, 2004
  5. Replies:
    7
    Views:
    404
Loading...

Share This Page