Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: LWP post

by esskar (Deacon)
on Feb 24, 2005 at 00:09 UTC ( #433911=note: print w/replies, xml ) Need Help??

in reply to LWP post

check LWP::UserAgent
an example:
use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 "); my $req = HTTP::Request->new(POST => ''); $req->content_type('application/x-www-form-urlencoded'); $req->content('query=libwww-perl&mode=dist'); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }
Update: Fixed the 'my'

Replies are listed 'Best First'.
Re^2: LWP post
by Anonymous Monk on Feb 24, 2005 at 05:36 UTC

    Let me know what do do the follwoing :

    my $ua->agent("MyApp/0.1 ");

    and what is MyApp/0.1

      (The my shouldn't be there.)

      The line is optional. It tells LWP what to put in the User-Agent field of the HTTP request, which is pretty much a free-format field. The default is indicates LWP is being used and which version of LWP is being used.

      Some web servers use this to return content specific for the browser identified by the string. Some web servers log this to monitor which browsers its users use.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2023-03-22 08:42 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.