Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

URL post

by Anonymous Monk
on Aug 18, 2003 at 22:52 UTC ( #284751=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am seeking some help with a script that triggers a script on a server to begin a process.

I have no great experience as perl expert. Here is what I have:

use HTTP::Request; use LWP::UserAgent; # Variables # my $url = " +ers"; my $ua = new LWP::UserAgent; my $res = $ua->request(POST $url); if ($res->success) { print $res->content || die "Not possible\n"; }
Thanks for any and all help.

edited by ybiC: balanced <code> tags

Replies are listed 'Best First'.
Re: URL post
by arthas (Hermit) on Aug 18, 2003 at 23:24 UTC


    The script has some errors. Here's a fixed version:

    use HTTP::Request; use LWP::UserAgent; my $url = " +ers"; my $ua = new LWP::UserAgent; my $req = new HTTP::Request(GET => $url); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { die "Not possible\n"; }

    Among the other things, you should really use GET as request method for an URL like the one you provided. Also, take a look at the numerous exampels in the LWP documentation, they're very useful.


Re: URL post
by tcf22 (Priest) on Aug 19, 2003 at 00:52 UTC
    CPAN can be very helpful, when it comes to getting examples on how to use modules.

    A simple search for LWP::UserAgent would have shown that you need an HTTP::Request object.

    A post from last week, Where and how to start learning Perl by woolfy, is worth taking a look at. It gives many fine perl resources.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (1)
As of 2022-10-01 17:33 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (3 votes). Check out past polls.