Here is the one to many working example.

<?php

$url = http://xxxx:13013/cgi-bin/sendsms';

$xml = '<?xml version="1.0"?>
<message>
<submit>
<da><number>919871701375</number></da>
<da><number>919871701375</number></da>
<da><number>919871701375</number></da>
<da><number>919871701375</number></da>
<from>
<username>xxx</username>
<password>xxx</password>
</from>
</submit>
</message>';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
$result = curl_exec($curl);
//$info = curl_getinfo($curl);
curl_close($curl);
echo $result;

On Mon, Dec 1, 2014 at 8:44 PM, michael osakede <ire...@yahoo.com> wrote:

> Hello All,
>
> I keep getting "Authorization failed for sendsms".
>
> My Send SMS config
> #---------------------------------------------
> # SEND-SMS USERS
> #
> # These users are used when Kannel smsbox sendsms interface is used to
> # send PUSH sms messages, i.e. calling URL like
> #
> http://kannel.machine:13013/cgi-bin/sendsms?username=tester&password=foobar.
> ..
>
> group = sendsms-user
> username = tester
> password = foobar
> dlr-url = "
> http://localhost/dlr.php?action=recvdlr&originator=%p&destination=%P&message=%a&dlrvalue=%d&timestamp=%t&smscid=%i&operator=%o&billing=%O
> "
> omit-empty = true
> max-messages = 1000
>
> My PHP Code:
> <?php
>
> $xml = '<?xml version="1.0" encoding="UTF-8"?>
> <message>
>         <submit>
>                 <da><number>2348098009386</number></da>
>                 <oa><number>747</number></oa>
>                 <ud>Test Message</ud>
>                 <statusrequest>
>                         <dlr-mask>31</dlr-mask>
>                          <dlr-url>
>
> http://127.0.0.1/delivery-report.php?send_history_id=13853217&to_number=91XXXXXXXXXX&type=%d
>                         </dlr-url>
>                 </statusrequest>
>                 <from>
>                         <username>tester</user>
>                       <password>foobar</password>
>                         <account>precin</account>
>                         <smsc-id>precin</smsc-id>
>                         <binfo>MO</binfo>
>                 </form>
>                 <to>precin</to>
>         </submit>
> </message>';
>
> //echo $xml;
> $xml=urlencode($xml);
> $url = "http://localhost:13013/cgi-bin/sendsms";;
>
> $username="tester";
> $password="foobar";
>
> $ch = curl_init($url);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
> curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
> curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml");
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> $output = curl_exec($ch);
> curl_close($ch);
> echo $output."RES";
> ?>
>
> Any idea what could be wrong?
>
>
>
>
>

Reply via email to