Monchanin Eric
Fri, 23 Jun 2006 02:26:51 -0700
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 WillyOn 6/23/06, * Luis Valencia* <[EMAIL PROTECTED] <[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 :SLuis Valencia ------------------------------------------------------------------------ *From:* Willy [EMAIL PROTECTED] <[EMAIL PROTECTED]>] *Sent:* Monday, June 19, 2006 8:05 PM *To:* Luis Valencia; users@kannel.org <mailto:users@kannel.org> *Subject:* Re: willy's php functionHI Luis, WAP Push uses the same UDH. Goodluck and please let us know if you successfully accomplish this mission :)RegardsWilly ----- Original Message ----- *From:* Luis Valencia <[EMAIL PROTECTED]> *To:* 'Willy' <[EMAIL PROTECTED]> ; users@kannel.org <mailto:users@kannel.org> *Sent:* Monday, June 19, 2006 11:55 PM *Subject:* RE: willy's php functionHi 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 [EMAIL PROTECTED] <[EMAIL PROTECTED]>] *Sent:* Sunday, June 18, 2006 9:13 PM *To:* Luis Valencia; users@kannel.org <mailto:users@kannel.org> *Subject:* Re: willy's php functionHi 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.RegardsWilly ----- Original Message ----- *From:* Luis Valencia <[EMAIL PROTECTED]> *To:* 'Willy' <[EMAIL PROTECTED]> ; users@kannel.org <mailto:users@kannel.org> *Sent:* Friday, June 16, 2006 10:17 PM *Subject:* RE: willy's php functionThank 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%01Thanks in advance for your advice.Luis Valencia ------------------------------------------------------------------------ *From:* Willy [EMAIL PROTECTED] <[EMAIL PROTECTED]>] *Sent:* Thursday, June 15, 2006 8:13 PM *To:* Luis Valencia; users@kannel.org <mailto:users@kannel.org> *Subject:* Re: willy's php functionHello 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.RegardsWilly ----- Original Message ----- *From:* Luis Valencia <[EMAIL PROTECTED]> *To:* users@kannel.org <mailto:users@kannel.org> *Sent:* Friday, June 16, 2006 7:32 AM *Subject:* willy's php functionHello 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 advanceLuis Valencia Asistencia Global S.A. Tel. 2428 1470 x 2523 Fax. 2428 1472