Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: how to add a refer to LWP::UserAgent

by BigRare (Pilgrim)
on May 22, 2006 at 19:27 UTC ( [id://551015]=note: print w/replies, xml ) Need Help??


in reply to how to add a refer to LWP::UserAgent

It would go something along the lines of this:
# Create a user agent object use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent("ima User Agent"); # Create a request my $req = HTTP::Request->new(GET => 'http://www.google.com'); $req->header(Accept => "text/html, */*;q=0.1", referer => 'http://ww +w.test.com/); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://551015]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2025-04-24 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.