Hi,


I want to push XML data file to the XML channel, please find the code
snippet for the same.



########

#!/usr/bin/perl

use LWP::UserAgent;

my $browser = LWP::UserAgent->new;

my $url     = 'http://xxx.xxx.xxx.xxx:xxxxx';

open(FILE,"display.xml");

my @data=<FILE>;

my $response = $browser->post( $url, Content => @data );

print @data;

########

When I print @data, it printing the full XML data on my console, but
doing a post like this only sends the very first XML tag, not all of the
contents in @data.

I have tried with the following methods which doesn't make any
difference in the Posted XML data, mentioned as above only very first
XML tag sent.

1)my $response = $browser->post( $url, Content => [EMAIL PROTECTED] );

2)my $response = $browser->post($url, Content => join('', @data));

3)Reading the data into a single scalar, not into an array as follows,

my $data = do {local $/; <FILE>;};
my $response = $browser->post( $url, Content => $data );

Source:http://www.perlmonks.org/?node_id=651037

Please help me on this.

Thanks in Advance!

Regards,

Shibu


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Reply via email to