Please help as per below; ---------- Forwarded message ---------- From: christopher serumola <[email protected]> Date: Thu, Sep 22, 2011 at 11:37 PM Subject: Re: php Wap push help To: Juan Nin <[email protected]>
Thanks Juan. I did replace the portion you referred to below with the code you provided below but i am still getting the same result. Maybe there is something else beyond this. I pass the following url to the firefox browser to execute the wappush script, http://localhost:8080/wappush.php. Port 8080 is the ppg-port. Strangely,immediately after getting the error message, when i change the php script name to any other name e.g to wap.php i still get the same error from the browser even though wap.php script does not exist in my webserver. In this case i expect it to return a "Page not found" error. I have also used the non-ppg script you suggested below but it returns a blank page and the message is not delivered to the mobile phone. Even when i view its page source it is blank. This one i ran it directly on port 80(default) i.e http://localhost/testwap.php. Any ideas? On Thu, Sep 22, 2011 at 3:12 AM, Juan Nin <[email protected]> wrote: > The only differences I see are on this part, this is your code: > > > '<push-message push-id="'.$wap_push_id.'">'."\r\n\t". > '<address address-value= > "WAPPUSH=+'.$country_code.$phone.'/[email protected]"<WAPPUSH=+%27.$country_code.$phone.%27/[email protected]> > />'."\r\n\t". > '<quality-of-service delivery-method="unconfirmed" network-required="true" > network="GSM" bearer-required="true" bearer="SMS"/>'. > "\r\n</push-message>\r\n". > "</pap>\r\n\r\n". > > This is my original code: > > '<push-message push-id="'.$wap_push_id.'">'."\r\n". > '<address > address-value="WAPPUSH=+'.$country_code.$phone.'/TYPE=PLMN@xxxxxxxxxxxxx"/>'."\r\n". > > '<quality-of-service delivery-method="unconfirmed" network="GSM" > bearer="SMS"/>'. > > "</push-message>\r\n". > "</pap>\r\n\r\n". > > On the first 2 lines you added a \t, not sure if that would affect, don't > think so, but I had a hard time getting my original code to work, since PPG > was very picky about the line breaks and line feeds > > On the third line you added network-required="true" and > bearer-required="true", I guess you checked those are valid options > > On the 4th line you added a \r\n at the beginning, although it would make > sense for that one to go, it may be the one breaking the thing. > As I mentioned, I spent lots of time tweaking line breaks and line feeds, > cause a missing one or an extra one would break it. > > So, I would start by taking out that extra \r\n from the 4th line. > If that doesn't make it, I would take out the \t's > And if that doesn't make it, take out the attributes you added. > > Another approach is to send wap push without PPG, via sendsms cgi, which is > much easier and you avoid running an extra service. > See here: http://www.blogalex.com/archives/12 > > On this article you can find what each hexadecimal value on the resultant > message means, and you can even do a more complete version: > > http://mobiforge.com/developing/story/binary-sms-sending-rich-content-devices-using-sms > > I'm currently using Alex's approach with something similar to this > (simplified code below): > > $udh = '%06%05%04%0B%84%23%F0'; > $text = '%1B%06%01%AE%02%05%6A%00%45%C6%0C%03'.hexEncode($url, '%'). > '%00%11%03'.hexEncode($si_id, > '%').'%00%07%01%03'.hexEncode($subject, '%').'%00%01%01'; > > > Hope this helps. > > > > On 9/21/11 3:02 AM, christopher serumola wrote: > > Yes, these are single lines on the php script. Its only that i use a dell > mini netbook with a small screen size which tends to wrap the text to the > next line when it is long. could that be the cause of the problem? > > On Tue, Sep 20, 2011 at 11:16 PM, Juan Nin <[email protected]> wrote: > >> Do you have these lines that on your email look like more than 1 line each >> as 1 line or more than 1 line? (should be 1) >> >> >> '<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP >> 1.0//EN"'."\r\n". >> >> >> '<address address-value="WAPPUSH= >> +'.$country_code.$phone.'/[email protected]"/>'."\r\n\t". >> >> >> '<quality-of-service delivery-method="unconfirmed" >> network-required="true" network="GSM" bearer-required="true" >> bearer="SMS"/>'. >> >> >> '<?xml version="1.0"?>'."\r\n". >> '<!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN"'."\r >> \n". >> >> >> '<indication action="signal-high" si-id="'.$wap_push_id.'" href="'. >> $push_url .'">'.$text.'</indication>'."\r\n". >> >> >> "X-Kannel-SMSC: $smsc_id\r\n".'Content-Type: multipart/related; >> boundary=multipart-boundary; type="application/xml"'."\r\n". >> >> >> >> On 9/20/11 4:38 PM, chris wrote: >> >>> I have installed kannel 1.5.0 on ubuntu 10.0.4 and configured >>> bearerbox,smsbox and wapbox. All are working well except that i can't >>> send wap pushes through ppg from the php sample script posted in the >>> mailing lists named "wappush.conf". i have checked all the related >>> postings on the matter and implemented the suggestions without >>> success.So i need help. The error message i get from the browser is; >>> >>> This XML file does not appear to have any style information associated >>> with it. The document tree is shown below. >>> >>> - >>> <pap> >>> <badmessage-response code="2000" desc="Not understood due to malformed >>> syntax" bad-message-fragment="No MIME content"/> >>> </pap> >>> >>> The wappush.php script(with corrected line feeds and indentation) used >>> is as below; >>> >>> <?php >>> $country_code = 'xxx'; >>> $phone = 'xxxxxxxx'; >>> $push_url = "http://m.yahoo.com"; >>> $text = 'Test yahoo wap'; >>> $smsc_id = 'mysmsc-id'; >>> >>> $out = send_wap_push($smsc_id, $country_code, $phone, $push_url, >>> $text); >>> echo $out; >>> >>> function send_wap_push($smsc_id, $country_code, $phone, $push_url, >>> $text) >>> { >>> $host = 'localhost'; >>> $port = '8080'; >>> $url = "http://$host:$port"; >>> >>> $ppg_user = 'push'; >>> $ppg_pass = 'push'; >>> >>> $wap_push_id = get_rand_numbers(5); >>> $body = "--multipart-boundary\r\n". >>> "Content-type: application/xml\r\n\r\n". >>> '<?xml version="1.0"?>'."\r\n". >>> '<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP >>> 1.0//EN"'."\r\n". >>> '"http://www.wapforum.org/DTD/pap_1.0.dtd">'."\r\n". >>> '<pap>'."\r\n". >>> '<push-message push-id="'.$wap_push_id.'">'."\r\n\t". >>> '<address address-value="WAPPUSH= >>> +'.$country_code.$phone.'/[email protected]"/>'."\r\n\t". >>> '<quality-of-service delivery-method="unconfirmed" >>> network-required="true" network="GSM" bearer-required="true" >>> bearer="SMS"/>'. >>> "\r\n</push-message>\r\n". >>> "</pap>\r\n\r\n". >>> "--multipart-boundary\r\n". >>> "Content-type: text/vnd.wap.si\r\n\r\n". >>> '<?xml version="1.0"?>'."\r\n". >>> '<!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN"'."\r >>> \n". >>> '"http://www.wapforum.org/DTD/si.dtd">'."\r\n". >>> "<si>\r\n". >>> '<indication action="signal-high" si-id="'.$wap_push_id.'" >>> href="'. >>> $push_url .'">'.$text.'</indication>'."\r\n". >>> "</si>\r\n"."--multipart-boundary--\r\n"; >>> >>> $post = "POST /wappush.php HTTP/1.1\r\n"."Host: $host:$port\r\n". >>> "Authorization: Basic >>> ".base64_encode("$ppg_user:$ppg_pass")."\r\n". >>> "X-Kannel-SMSC: $smsc_id\r\n".'Content-Type: >>> multipart/related; >>> boundary=multipart-boundary; type="application/xml"'."\r\n". >>> "Content-Length: ".strlen($body)."\r\n"."\r\n".$body; >>> >>> $ch = curl_init(); >>> curl_setopt ($ch, CURLOPT_URL, $url); >>> curl_setopt($ch, CURLOPT_HEADER, 1); >>> curl_setopt($ch, CURLOPT_TIMEOUT, 15); >>> curl_setopt ($ch,CURLOPT_CUSTOMREQUEST , $post); >>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); >>> $reply = curl_exec($ch); >>> curl_close ($ch); >>> return $reply; >>> //print_r($post.$body); >>> } >>> >>> function assign_rand_value($num) >>> { >>> // accepts 1 - 36 >>> switch($num) >>> { >>> case "1": >>> $rand_value = "a"; >>> break; >>> case "2": >>> $rand_value = "b"; >>> break; >>> case "3": >>> $rand_value = "c"; >>> break; >>> case "4": >>> $rand_value = "d"; >>> break; >>> case "5": >>> $rand_value = "e"; >>> break; >>> case "6": >>> $rand_value = "f"; >>> break; >>> case "7": >>> $rand_value = "g"; >>> break; >>> case "8": >>> $rand_value = "h"; >>> break; >>> case "9": >>> $rand_value = "i"; >>> break; >>> case "10": >>> $rand_value = "j"; >>> break; >>> case "11": >>> $rand_value = "k"; >>> break; >>> case "12": >>> $rand_value = "l"; >>> break; >>> case "13": >>> $rand_value = "m"; >>> break; >>> case "14": >>> $rand_value = "n"; >>> break; >>> case "15": >>> $rand_value = "o"; >>> break; >>> case "16": >>> $rand_value = "p"; >>> break; >>> case "17": >>> $rand_value = "q"; >>> break; >>> case "18": >>> $rand_value = "r"; >>> break; >>> case "19": >>> $rand_value = "s"; >>> break; >>> case "20": >>> $rand_value = "t"; >>> break; >>> case "21": >>> $rand_value = "u"; >>> break; >>> case "22": >>> $rand_value = "v"; >>> break; >>> case "23": >>> $rand_value = "w"; >>> break; >>> case "24": >>> $rand_value = "x"; >>> break; >>> case "25": >>> $rand_value = "y"; >>> break; >>> case "26": >>> $rand_value = "z"; >>> break; >>> case "27": >>> $rand_value = "0"; >>> break; >>> case "28": >>> $rand_value = "1"; >>> break; >>> case "29": >>> $rand_value = "2"; >>> break; >>> case "30": >>> $rand_value = "3"; >>> break; >>> case "31": >>> $rand_value = "4"; >>> break; >>> case "32": >>> $rand_value = "5"; >>> break; >>> case "33": >>> $rand_value = "6"; >>> break; >>> case "34": >>> $rand_value = "7"; >>> break; >>> case "35": >>> $rand_value = "8"; >>> break; >>> case "36": >>> $rand_value = "9"; >>> break; >>> } >>> return $rand_value; >>> } >>> >>> function get_rand_numbers($length) >>> { >>> if($length>0) >>> { >>> $rand_id=""; >>> for($i=1; $i<=$length; $i++) >>> { >>> mt_srand((double)microtime() * 1000000); >>> $num = mt_rand(27,36); >>> $rand_id .= assign_rand_value($num); >>> } >>> } >>> return $rand_id; >>> } >>> >>> ?> >>> >>> and from the wap log file; >>> >>> 2011-09-20 21:02:23 [1833] [14] INFO: PPG: Accept request</wappush.php> >>> from<127.0.0.1> >>> 2011-09-20 21:02:23 [1833] [14] WARNING: PPG: No MIME content received, >>> the request unacceptable >>> 2011-09-20 21:02:23 [1833] [14] DEBUG: PPG: send_bad_message_response: >>> telling pi >>> 2011-09-20 21:02:23 [1833] [14] DEBUG: HTTP: Resetting HTTPClient for >>> `127.0.0.1'. >>> 2011-09-20 21:02:23 [1833] [11] DEBUG: HTTP: Creating HTTPClient for >>> `127.0.0.1'. >>> 2011-09-20 21:02:23 [1833] [11] DEBUG: HTTP: Created HTTPClient area >>> 0x99ec880. >>> 2011-09-20 21:02:24 [1833] [14] ERROR: Request</favicon.ico> from >>> <127.0.0.1>: service not found >>> 2011-09-20 21:02:24 [1833] [14] DEBUG: your configuration >>> uses /wappush.php >>> 2011-09-20 21:02:24 [1833] [14] DEBUG: HTTP: Resetting HTTPClient for >>> `127.0.0.1'. >>> 2011-09-20 21:03:23 [1833] [10] DEBUG: HTTP: Destroying HTTPClient area >>> 0x99ec880. >>> 2011-09-20 21:03:23 [1833] [10] DEBUG: HTTP: Destroying HTTPClient for >>> `127.0.0.1'. >>> >>> and my kannel configuration file; >>> >>> group = core >>> admin-port = 13050 >>> smsbox-port = 13051 >>> wapbox-port= 13052 >>> admin-password= chris >>> dlr-storage = mysql >>> wdp-interface-name="*" >>> log-file = "/var/log/kannel/bearerbox.log" >>> log-level=0 >>> box-deny-ip = "*.*.*.*" >>> box-allow-ip = "127.0.0.1" >>> >>> group=smsc >>> smsc-id=mysmsc-id >>> port=13053 >>> smsc=at >>> modemtype=huawei >>> device=/dev/ttyUSB0 >>> #speed=115200 >>> my-number=xxxxxxxxxx >>> validityperiod=167 >>> pin=7172 >>> sim-buffering=true >>> #keepalive=5 >>> sms-center=+xxxxxxxxxx >>> >>> group=modems >>> id=huawei >>> name="huawei E230" >>> detect-string="huawei" >>> init-string="ATZ" >>> init-string="AT+CNMI=2,1,2,2,0" >>> enable-hwhs=false >>> message-storage=SM >>> message-start=0 >>> #speed=115200 >>> >>> group=smsbox >>> #smsbox-id=smsbox1 >>> bearerbox-host=127.0.0.1 >>> sendsms-port=13054 >>> global-sender=xxxxxxxxxxx >>> sendsms-chars="0123456789+-" >>> log-file = "/var/log/kannel/smsbox.log" >>> log-level=0 >>> >>> group=sendsms-user >>> username=kannel >>> password=kannel >>> concatenation=true >>> max-messages=10 >>> >>> #Receive MO sms and direct to specified url >>> group=sms-service >>> keyword=default >>> get-url="http://localhost/receivesms.php?sender=%p&text=%b" >>> #accept-x-kannel-headers=true >>> #accepted-smsc=smsbox1 >>> max-messages=1 >>> catch-all=true >>> >>> #Set up wap pushes >>> group=wapbox >>> bearerbox-host=127.0.0.1 >>> log-file = "/var/log/kannel/wapbox.log" >>> access-log="/var/log/kannel/wapacess.log" >>> log-level=0 >>> syslog-level=none >>> >>> group=ppg >>> ppg-url=/wappush.php >>> ppg-port=8080 >>> concurrent-pushes=100 >>> global-sender="xxxxxxxxxxx" >>> users=1024 >>> ppg-allow-ip="127.0.0.1" >>> trusted-pi=true >>> >>> group=wap-push-user >>> wap-push-user=wappusher >>> ppg-username=push >>> ppg-password=push >>> allow-ip="*.*.*.*" >>> >>> #Use mysql database for storing delivery reports for MT sms >>> group=mysql-connection >>> id=mydlr >>> host=localhost >>> username=root >>> password=xxxxxxxx >>> database=dlr >>> max-connections=1 >>> >>> group=dlr-db >>> id=mydlr >>> table=dlr >>> field-smsc=smsc >>> field-timestamp=ts >>> field-destination=destination >>> field-source=source >>> field-service=service >>> field-url=url >>> field-mask=mask >>> field-status=status >>> field-boxc-id=boxc >>> >>> #group = sqlbox >>> #id = sqlbox-db >>> #smsbox-id = smsbox >>> #bearerbox-host = 127.0.0.1 >>> #bearerbox-port = 13003 >>> #smsbox-port = 13005 >>> #log-file = "/var/log/kannel/sqlbox.log" >>> #log-level = 0 >>> >>> # Example MYSQL Connection >>> #group = mysql-connection >>> #id = sqlbox-db >>> #host = localhost >>> #username = root >>> #password = xxxxxxxx >>> #database = dlr >>> >>> i would really appreciate as comprehensive help as possible. >>> >>> >>> >>> >>> >>> >> > >
