Re: how to send data to a URL?

2007-05-31 Thread Andy Lester


On May 31, 2007, at 5:16 PM, vidals wrote:


I use LWP all the time for requesting web pages, but can somebody
provide some guidance as to how LWP can be used to send data? I'm
confused.


Use WWW::Mechanize, which is a wrapper around LWP and includes many  
useful examples of POSTing data.


--
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance






Re: how to send data to a URL?

2007-05-31 Thread Tim Allwine

Andy Lester wrote:


On May 31, 2007, at 5:16 PM, vidals wrote:


I use LWP all the time for requesting web pages, but can somebody
provide some guidance as to how LWP can be used to send data? I'm
confused.


Use WWW::Mechanize, which is a wrapper around LWP and includes many 
useful examples of POSTing data.





Or if you like yours 'neat'

use LWP;
my $ua = LWP::UserAgent-new();
my $req = HTTP::Request-new(POST = 'http://fancywebservice.com');
my $xml = get_xml_data(); # your function here
my $length = length($xml);
$req-content($xml);
$req-header('Content-length' = $length);

my $res =  $ua-request($req);
my $response_data = $res-content;

you might want to do a little more reading after this point.

-Tim