Hello,
Here are my php functions to send a wappush.
I wrote this using the mail list history, so I guess that's what u're looking for :

I hope this helps
These functions work for me since a few time now without any problem.

# as u can guess, $fields is an array with 2 params :
# $fields ['link'] = 'http://blabla.com/blalba.wml';
# $fields ['title'] = 'this is the push title';

function send_wappush ($fields) {
       $fields['udh']  = '%06%05%04%0B%84%23%F0';
       $fields['text'] = '%1B%06%01%AE%02%05%6A%00%45%C6%0C%03'.
                       hex_encode($fields['link'], '%').
                       '%00%01%03'.
                       hex_encode($fields['title'], '%').
                       '%00%01%01';
       unset ( $fields['title'], $fields['link'] );

       $string = '';
       while(list($k,$v) = each($fields)) {
               if ( $v != "" )
               {
                       $string .= "&$k=$v";
               }
       }
       send_req ($string);
}

function send_req ($string)
{
       require_once ('/webhome/functions/configurations/kannel.inc');
       $request =      'http://'.$kannel['host'].':'.$kannel['port'].
                       '/cgi-bin/sendsms'.
                       '?user='.$kannel['user'].
                       '&pass='.$kannel['pass'].
                       $string;

       $result = @file( $request );
       return 'ok';
}

function hex_encode( $text, $joiner='' )
{
       $ret = "";
       for ($l=0; $l<strlen($text); $l++) {
               $letter = substr($text, $l, 1);
               $ret .= sprintf("%s%02X", $joiner, ord($letter));
       }
       return $ret;
}

Willy Mularto a écrit :
Hi Luis,
I think you need to find more refference about the definition of WAP push. Obviously you miss interpret it.

Regards


Willy

On 6/23/06, * Luis Valencia* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi Willy, after several tries I wasn't able to receive the push.
     Here's what im doing:

    
http://10.27.1.219:13200/sendsms?user=lvalencia&password=lvalencia&to=50257197283&text=http://wap.google.com&udh=%06%05%04%0B%84%23%F0
    
<http://10.27.1.219:13200/sendsms?user=lvalencia&password=lvalencia&to=50257197283&text=http://wap.google.com&udh=%06%05%04%0B%84%23%F0>

    I already try putting a %2B before the phone number, but doesn't
    change anything.

    2006-06-22 11:30:48 [17876] [2] DEBUG: HTTP: Creating HTTPClient
    for `10.27.1.213'.

    2006-06-22 11:30:48 [17876] [3] INFO: smsbox: Got HTTP request
    </sendsms> from <10.27.1.213 <http://10.27.1.213>>

    2006-06-22 11:30:48 [17876] [3] INFO: sendsms used by <lvalencia>

    2006-06-22 11:30:48 [17876] [3] INFO: sendsms sender:<lvalencia:911>

    (10.27.1.213 <http://10.27.1.213>) to:<50257197283>
    msg:<http://wap.google.com>

    2006-06-22 11:30:48 [17876] [3] DEBUG: message length 21, sending
    1 messages

    2006-06-22 11:30:48 [17876] [3] DEBUG: Status: 202 Answer: <Sent.>

    2006-06-22 11:30:48 [17876] [3] DEBUG: HTTP: Resetting HTTPClient
    for `10.27.1.213'.

    Please help me, what im doing wrong?  This doesn't look to
    difficult to do :S

    Luis Valencia

    ------------------------------------------------------------------------

    *From:* Willy [mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>]
    *Sent:* Monday, June 19, 2006 8:05 PM


    *To:* Luis Valencia; [email protected] <mailto:[email protected]>
    *Subject:* Re: willy's php function

    HI Luis,

    WAP Push uses the same UDH. Goodluck and please let us know if you
    successfully accomplish this mission :)

    Regards

    Willy

        ----- Original Message -----

        *From:* Luis Valencia <mailto:[EMAIL PROTECTED]>

        *To:* 'Willy' <mailto:[EMAIL PROTECTED]> ; [email protected]
        <mailto:[email protected]>

        *Sent:* Monday, June 19, 2006 11:55 PM

        *Subject:* RE: willy's php function

        Hi Willy, im almost clear now, just one little question.

        What UDH should I use? Its always the same or it changes for
        each page send?

        Sorry if im such annoying, but im confuse about this subject.

        Luis Valencia

        ------------------------------------------------------------------------

        *From:* Willy [mailto:[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>]
        *Sent:* Sunday, June 18, 2006 9:13 PM
        *To:* Luis Valencia; [email protected] <mailto:[email protected]>
        *Subject:* Re: willy's php function

        Hi Luis,

        You don't need to transform it, Kannel will automatically
        transform the URL part into hex AFAIK. But if you want to
        transform some character into hex, I usually use bin2hex()
        function in PHP.

        Regards

        Willy

            ----- Original Message -----

            *From:* Luis Valencia
            <mailto:[EMAIL PROTECTED]>

            *To:* 'Willy' <mailto:[EMAIL PROTECTED]> ;
            [email protected] <mailto:[email protected]>

            *Sent:* Friday, June 16, 2006 10:17 PM

            *Subject:* RE: willy's php function

            Thank you Willy, and is option 1, I want to send the same
            wap push to many receivers.

            Besides my other doubt is about translating the
            http://wap.google.com (for example) into that Hex sequence
            Im seeing it has to be used.

            How do I get the UDH??  How to I make the text sequence??

            This is one I found in the list:

            
http://localhost:13013/cgi-bin/sendsms?username=kannel&password=kannel
            
<http://localhost:13013/cgi-bin/sendsms?username=kannel&password=kannel>
            &to=50257197283&udh=%06%05%04%0B%84%23%F0
            &text=%07%06%17%B0%96%6C%6F%63%61%6C%68%6F%73%74%3A%39%30%38%30%00
            %AF%80%8D%95%B4%02%06%6A%00%85%09%03wap.nokia.de%00%01

            Thanks in advance for your advice.

            Luis Valencia

            
------------------------------------------------------------------------

            *From:* Willy [mailto:[EMAIL PROTECTED]
            <mailto:[EMAIL PROTECTED]>]
            *Sent:* Thursday, June 15, 2006 8:13 PM
            *To:* Luis Valencia; [email protected]
            <mailto:[email protected]>
            *Subject:* Re: willy's php function

            Hello Luis,

            There are two possibilities here.

            1. You want to send the same WAP Push to many receiver

            2. You want to send dynamics WAP Push to many receiver

            And here is my suggestion and I assume that you use
            Kannel's /sendsms? script:

            1. Just add the receiver number next to the "to" variable
            (ie:/sendsms?smsc=mysmsc&from=ABC&to=123 456 789..)

            2. You need to do some loops, or you can use the SQLBox to
            do the job.

            Regards

            Willy

                ----- Original Message -----

                *From:* Luis Valencia
                <mailto:[EMAIL PROTECTED]>

                *To:* [email protected] <mailto:[email protected]>

                *Sent:* Friday, June 16, 2006 7:32 AM

                *Subject:* willy's php function

                Hello everyone,

                Finally I can receive a wap push using the test_ppg
                and using SI.

                But now I want to send wap push to many phone numbers,
                which is the best way to do this?

                I found in the archives a PHP function made by Willy,
                so I can send the wap push using sms, but Im not clear
                how to use it.

                Im not an expert in php so please explain like I was
                two years old.

                Thanks in advance

                Luis Valencia

                Asistencia Global S.A.

                Tel. 2428 1470 x 2523

                Fax. 2428 1472




Reply via email to