cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enrico.macc...@free.fr
Subject Re: cocoon & JMS
Date Fri, 02 Jan 2004 18:07:00 GMT
Selon Upayavira <uv@upaya.co.uk>:

> enrico.maccias@free.fr wrote:
> 
> #!/usr/bin/perl
> 
> use LWP::UserAgent;
> 
> my $userAgent=LWP::UserAgent->new();
> my $response=$userAgent->get("http://localhost:8080/cocoon/your_url");
> open(out, ">file.txt");
> print out $response->content;
> close(out);
> 
> Thus, you've asked perl to go get a page from Cocoon by HTTP, and then 
> written it to disk. The pipeline can just look for the file where the 
> FTP put it.
> 
> If you do want to post by HTTP, here's some code:
> 
> #!/usr/bin/perl
> 
> use LWP 5.64;
> 
> my $content = "<xml>Some XML</xml>";
> my $request = HTTP::Request->new("POST");
> 
> $request->header("Content-Type","text/xml");
> $request->content($content);
> $request->url("http://yourserver/cocoon/url");
> 
> my $ua = LWP::UserAgent->new;
> my $response = $ua->request($request);
> 
> if ($response->is_success) {
>   print $response->content,"\n";
> } else {
>   print "ERROR: ",$response->status_line,"\n";
> }
> 
> Does this help?

Yes, it does! :) Thanks a lot!

Enrico.


> 
> Regards, Upayavira

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message