perl xml post example

my $message ="
<?xml version=\"1.0\"$encoding?>
<message>
        <submit>
        <da><number>+$data->{msisdn}</number></da>
        <oa><number>$data->{shortcode}</number></oa>
        <ud>$data->{sms}</ud>
        <udh>$udh</udh>
        <dcs>
                <mclass>$mclass</mclass>
                <coding>$coding</coding>
                <mwi>$mwi</mwi>
                <compress>-1</compress>
                <alt-dcs>$alt_dcs</alt-dcs>
        </dcs>
        <pid></pid>
        <rpi></rpi>
        <vp>
                <delay>$data->{validity}</delay>
        </vp>
        <timing>
                <delay></delay>
        </timing>
        <priority>1</priority>
        <statusrequest>
                <dlr-mask>$dlr</dlr-mask>
                <dlr-url>$dlrURL</dlr-url>
        </statusrequest>
                <from>
                        <user>seik</user>
                        <pass>slackware</pass>
                        <account>slackware</account>
                        <bininfo>MT</account>
                </from>
                <to>mtel</to>
        </submit>
</message>
";

 my $userAgent = LWP::UserAgent->new(agent => '[email protected]');
 $userAgent->timeout(10);
 my $response = $userAgent->request(POST $url,Content_Type => 
'text/xml',Content => $message);


-----Original Message-----
From: Sridhar Bandi [EMAIL PROTECTED]
Sent: 19 ???????? 2007 ?.
To: seik
Subject:Kannel : SMS POST request using Perl 

> Greetings,

> I am very new to Kannel and PERL.

> I would like to send SMS to the Kannel server using a perl script
> using LWP::UserAgent and HTTP::Request. I could succeed to send the
> SMS using the GET message as follows:-

$response = $ua->>request(HTTP::Request->new('GET', 
"http://hostname:13013/cgi-bin/sendsms?username=user&password=pass&to=$phone&text=$text";,
 HTTP::Headers->new(Content_Type => "text/xml")));


> But I would like to send a POST message but couldn't succeed in
> passing proper values to the content. Can someone help in writing
> the content part of the POST message.

> Thanks in advance.

> regards,
> sridhar
>   
> Looking for last minute shopping deals? Find them fast with Yahoo! Search.


Reply via email to