Hi Alejandro

Many thanks for your answer y tried it and worked fine. 

Best Regards

Oscar Flores

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Alejandro Guerrieri
Sent: Thursday, April 01, 2004 5:55 PM
To: [EMAIL PROTECTED]
Subject: Re: WAP Push Configuration


Oscar,

I've been crawling the �net many days and I've found ut is not an easy
issue.

After many hours investigating, I've found a couple of documents and
I've 
managed to put togheter (partially based on the sendsms routine from 
Kannel) a function to make a sendwappush using PHP.

Fill the $kannel and $fields arrays with your settings and you should be

all set. You can pass as many parameters as you want on the $fields
array, 
as long as they are recognized by Kannel's sendsms interface, of course.

The function still needs to be polished and optimized (it does not
handle 
any kind of errors) but it works well.

<?
   $kannel = array (
                            host => 'localhost',
                            port => 13013,
                            user => 'foo',
                            pass => 'bar'
                           );

   $fields   = array (
                            from  => '+34123456789',
                            to    => '+34987654321',
                            smsc  => 'your_smsc',
                            link  => 'your_url/your_file.ext',
                            title => 'This is the title'
                           );


   sendwappush ( $fields, $kannel );
   print "SENT<br>";

/*
   sendwappush function.
   Copyleft 2004 by Alejandro Guerrieri
   This code is open source and GPL licensed
*/
   function sendwappush ($fields, $kannel, $debug=0) {
     $fields[udh]  = '%06%05%04%0B%84%23%F0';
     $fields[text] = '%1B%06%01%AE%02%05%6A%00%45%C6%0C%03'.
                          urlencode($fields[link]).
                          '%00%01%03'.
                          urlencode($fields[title]).
                          '%00%01%01';
     unset ( $fields[title], $fields[link] );

     while(list($k,$v) = each($fields)) {
       if ( $v != "" ) {
         $string .= "&$k=$v";
       }
     }
     $result = @file("http://".$kannel[host].":".$kannel[port].
                           "/cgi-bin/sendsms".
                           "?user=".$kannel[user].
                           "&pass=".$kannel[pass].
                           "&".$string);
   }
?>

Regards,

At 23:34 01/04/2004, you wrote:
>Hi list,
>
>I want to send wap push messages and I'm really newbie on this, I've
>been looking in the documentation and also y the mail list. After that
>I'm very confused.
>
>Would someone of you like to explain me how this works?, how to I
>convert the XML code into hex to put in the sendsms.php script.
>
>Any answer will be highly appreciated
>
>Many thanks
>
>Oscar Flores

--
Alejandro Guerrieri
Magicom
[EMAIL PROTECTED]





Reply via email to