whenever i try 2 send sms thru my script sendsms.php ,i m getting
authentication failed error. Exact trace is as follows:

Sending the SMS Text message *hello* to the phone *97xxxxxxxxxx*.
\n

Server: Kannel/1.4.3

Date: Wed, 30 Jun 2010 10:45:12 GMT

Pragma: no-cache

Cache-Control: no-cache

Authorization failed for sendsms

For Authentication while creating the URL variable in SENDSMS.PHP ,i am
passing the username and password with values as string.Here my Query is
that which username and password i.e.(CORE GROUP OR SENDSMS GROUP-FILES
ATTACHED:-SENDSMS.PHP AND OTHER INCLUDE FILES ARE ATTACHED) has to be passed
in the URL?

Apart from this i want 2 know what is another method for authentication for
kannel gateway.
Please Enlighten me on this.

*kannel.conf is as follows:-*
# CORE
group = core
admin-port = 13000
admin-password = yourpassword
status-password = yourpassword
log-file = "/var/log/kannel/kannel.log"
log-level = 0
 access-log = "/var/log/kannel/access.log"
smsbox-port = 13001
store-type = file
store-file = "/var/log/kannel/kannel.store"
store-location = "/var/log/kannel/kannel.store"


# SMSC Fake
group = smsc
smsc = at
device = /dev/ttyACM1
port = 13000



# MODEM DEFINITIONS
group = modems
id = nokia
name = "Nokia"
detect-string = "Nokia"
init-string = "ATZ"
init-string = "AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"


# SMSBOX SETUP
group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
sendsms-chars = "0123456789+"
global-sender = "test"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/access.log"
#sendsms-url="http://localhost:13013/sendsms.php";
white-list="http://localhost:13013/sendsms.php";



# SEND-SMS USERS
group = sendsms-user
username = yourpassword
password = yourpassword
concatenation = 1
max-messages = 10


# SMS SERVICE GET-URL EXAMPLE
group = sms-service
keyword = relay
*get-url = "http://localhost:13013/sendsms.php"**
*

# SMS SERVICE 'default'
group = sms-service
keyword = nop
text = "You asked nothing and I did it!"
catch-all = true # Catch all incoming messages
                 # regarding the keyword. If you
                 # define other services, remove
                 # this line.


# SMS SERVICE for receiving sms messages
# If you're about to implement service to receive sms messages.
# group = sms-service
# keyword = yourkeyword
# get-url =
http://server.domain/moodle/receivesms.php?q=%k&sender=%p&message=%a
*
SENDSMS.PHP is as follows:-*

<html>
<head>
<title>SMS Message Sender</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">

<?php
include("config.inc");
include("functions.inc");

if(!empty($_POST))
{
echo 'Sending the SMS Text message <b>'.$_POST['text'].'</b> to the phone
<b>'.$_POST['to'].'</b>...<br>\n';

*$URL =
'/cgi-bin/sendsms?username="yourpassword"&password="yourpassword"&to='.$_POST['to'].'&text='.htmlentities($_POST['text']);
*
http_send($URL,13013);
//echo "<address><a href=\"$PHP_SELF\">Back to Send SMS</a></address>\n";

//print_r($_POST);
}
?>

<h1>SMS Message Sender</h1>
<form name="sendsms" method="post" action="?">
<p>
Telephone number:
<br>
<input type="text" size="30" name="to">
</p>
<p>
Message:
<br>
<textarea cols="20" rows="5" name="text"></textarea>
</p>
<input type="submit" value="Send Message" name="submit">
<input type="reset" value="Reset">
<br>
</form>


<p>
</p>
<hr>
<table border="0" width="100%">
<tr>
<td width="50%"><address><a href="index.php">Back to
admin</a></address></td>
<td width="50%" align="right"><address>Visit the Kannel homepage at <a
href="(URL address blocked: See forums rules)">(URL address blocked: See
forums rules)</a>.</address></td>
</tr>
</table>
</body>
</html>


<html>


<head>
<title>SMS Message Sender</title>



</head>



<body bgcolor="#FFFFFF" text="#000000">


*INCLUDE FILE CONFIG.INC  is as follows:-

*

<?php
// Include file for SMS interface.

// These variables MUST match your kannel.conf configuration

$bearerboxhost = "localhost";
define("BEARERBOX_HOST", "localhost");
define("SENDSMS_PORT",   "13001");
define("ADMIN_PORT",     "13000");
define("ADMIN_PASSWORD", "yourpassword");
define("USERNAME",       "yourpassword");
define("PASSWORD",       "yourpassword");
define("GLOBAL_SENDER",  "test");
?>


*INCLUDE FILE FUNCTIONS.INC IS AS FOLLOWS:-

<?php

function http_send($URL,$port)
{
 $connection =
fsockopen(BEARERBOX_HOST,$port,&$error_number,&$error_description,60);
 if(!$connection) {
  echo "<p>$error_description ($error_number)<br>\n";
  echo "The SMS message was NOT sent!</p>\n";
 } else {
  socket_set_blocking($connection, false);
  fputs($connection, "GET $URL HTTP/1.0\r\n\r\n");
  while (!feof($connection)) {
   $myline = fgets($connection, 128);
   switch($myline)
   {
     case (strstr($myline, 'Content-')): break;
     case (strstr($myline, 'HTTP/1')): break;
     case "": break;
     case "\r\n": break;
     default: echo "<p>".$myline."</p>";
   }
  }
  fclose ($connection);

 }
}

function octstr_append_cstr($mystring)
{
 for($pos=0;$pos<strlen($mystring);$pos++) {
  $mystring2 .= sprintf("%%%02x",$mystring[$pos]);
 }
 return ($mystring2);
}
?>
*
PRASHANT SINGH

Reply via email to