Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 examining the Monastery: (4)
As of 2024-03-29 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found