Again

The call to call kannel should be like:

http://127.0.0.1:13013/cgi-bin/sendsms?username=user&password=pass&to=12345678&text=test

Therefore you need to adjust your script to do so.

Test the above url in your browser or with lynx changing the phone number.

Do a smaller/less complex script with the $URL and destination
hardcoded, no variables and see what happens

What is the content of your $URL variable and port in http_send($URL,$port)?

$URL should be something like
"cgi-bin/sendsms?username=user&password=pass&to=12345678&text=test"

Attach LOGS



|-----------------------------------------------------------------------------------------------------------------|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y Nextel
en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via
SMS y GPRS online
              Visitenos en www.perusms.NET www.smsglobal.com.mx y
www.pravcom.com



On Wed, Jun 30, 2010 at 11:52 AM, prashant singh
<prashantsing...@gmail.com> wrote:
> url variable created in sendsms.php is passed to the function written
> below.  i didnt get the way to pass values collected from sendsms.php to
> kannel, please guide me in configuring kannel.conf, what variables under
> which group are to be added.
> thanx in advance.
>
> 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);
> }
> ?>
>
>
> Regards,
> Prashant singh
>
>
>
>
>
>
> On Wed, Jun 30, 2010 at 10:16 PM, Alvaro Cornejo <cornejo.alv...@gmail.com>
> wrote:
>>
>> What does your sendsms.php sends to kannel?
>>
>> It --your sendsms.php-- should send something like:
>>
>>
>> http://127.0.0.1:13013/cgi-bin/sendsms?username=user&password=pass&to=12345678&text=test
>>
>> sendsms.php is in your local webserver and kannel has nothing to do with
>> it.
>>
>> Also, white listing allows for IP list and --I think-- hostanames, not
>> url, so
>>
>> white-list="http://localhost:13013/sendsms.php";
>> Should be:
>> white-list="localhost;127.0.0.1;"
>>
>> Or try to comment it out for debugging
>>
>>
>>
>>
>>
>>
>>
>> |-----------------------------------------------------------------------------------------------------------------|
>> Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
>> celular y Nextel
>> en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via
>> SMS y GPRS online
>>              Visitenos en www.perusms.NET www.smsglobal.com.mx y
>> www.pravcom.com
>>
>>
>>
>> On Wed, Jun 30, 2010 at 11:26 AM, prashant singh
>> <prashantsing...@gmail.com> wrote:
>> > i am calling the url http://localhost/sendsms.php from firefox the error
>> > i
>> > am getting back is :
>> >
>> > 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
>> >
>> > what to do now
>> >
>> >
>> > my sendsms.php goes like this
>> >
>> >
>> > <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">
>> >
>> > On Wed, Jun 30, 2010 at 9:39 PM, Alvaro Cornejo
>> > <cornejo.alv...@gmail.com>
>> > wrote:
>> >>
>> >> your url call should be someting like:
>> >>
>> >>
>> >>
>> >> http://127.0.0.1:13013/cgi-bin/sendsms?username=user&password=pass&to=12345678&text=test
>> >>
>> >> where username/password are the ones defined in SENDSMS-USER config.
>> >>
>> >> Post your full url.
>> >>
>> >> have you tried to call your url from a browser or with lynx? What did
>> >> you get bac?
>> >>
>> >> If you get error, try with the simplest call you can have -- like the
>> >> example below-- and check. If ok add one parameter each time until you
>> >> get the error.
>> >>
>> >> Hope helps else post kannel logs
>> >>
>> >> Alvaro
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> |-----------------------------------------------------------------------------------------------------------------|
>> >> Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
>> >> celular y Nextel
>> >> en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via
>> >> SMS y GPRS online
>> >>              Visitenos en www.perusms.NET www.smsglobal.com.mx y
>> >> www.pravcom.com
>> >>
>> >>
>> >>
>> >> On Wed, Jun 30, 2010 at 10:23 AM, prashant singh
>> >> <prashantsing...@gmail.com> wrote:
>> >> > i am using the yourpassword defined in sendsms group as well as in
>> >> > config.inc file(please see the kannel.conf file in the mail).
>> >> > i am creating the url in sendsms.php as $url where i am passing the
>> >> > username,password,phone no,text.
>> >> > if possible please elaborate the process of calling kannel that u
>> >> > mentioned in previous mail.
>> >> >
>> >> >
>> >> >
>> >> > On 6/30/10, Alvaro Cornejo <cornejo.alv...@gmail.com> wrote:
>> >> >> Which "yourpassword" are you usring to send the message to kannel?
>> >> >> You
>> >> >> must use sendsms-user password when calling kannel.
>> >> >>
>> >> >> Regards
>> >> >>
>> >> >> Alvaro
>> >> >>
>> >> >>
>> >> >>
>> >> >> |-----------------------------------------------------------------------------------------------------------------|
>> >> >> Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde
>> >> >> cualquier
>> >> >> celular y Nextel
>> >> >> en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias
>> >> >> via
>> >> >> SMS y GPRS online
>> >> >>               Visitenos en www.perusms.NET www.smsglobal.com.mx y
>> >> >> www.pravcom.com
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Wed, Jun 30, 2010 at 6:07 AM, prashant singh
>> >> >> <prashantsing...@gmail.com> wrote:
>> >> >>> 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