You're maybe having some problem with some "\r\n" or similar, when I
first did it I spent some time tweaking that until it worked...

I once sent to the list my "PPG Mini HOWTO", where I included some PHP
code quite similar to the one I'm using on production:

http://article.gmane.org/gmane.comp.mobile.kannel.user/11009/match=ppg+send+url

Here's the PHP code part, hope it helps:

<?

$country_code = '12';
$phone = '1234567890';
$push_url = 'http://wap.google.com';
$text = 'This is a test';
$smsc_id  = 'mySMSCid';

send_wap_push($smsc_id, $country_code, $phone, $url, $text);

function send_wap_push($smsc_id, $country_code, $phone, $push_url, $text)
{
        $host = 'xxx.xxx.xxx.xxx';
        $port = '8080';
        $url  =  "http://$host:$port";;
        
        //$ppg_user = 'foo';
        //$ppg_pass = 'bar';
        
        $wap_push_id = function_that_generates_a_unique_id();

        $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".
                        '<address 
address-value="WAPPUSH=+'.$country_code.$phone.'/[EMAIL PROTECTED]"/>'."\r\n".
                        '<quality-of-service delivery-method="unconfirmed" 
network="GSM"
bearer="SMS"/>'.
                        "</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 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);
        
        print_r($reply);
}

?>

On 10/19/07, nxs_02 <[EMAIL PROTECTED]> wrote:
>
> hi i want to ask about http request for wap push in kannel, here my source
> code.
>
> <?php
> echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
> echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\"
> \"http://www.wapforum.org/DTD/wml_1.2.xml\";>";
>
>         $msisdn = "+6281xxxxxxx";
>         $txt = "Anda Mandapat Pesan";
>         $link = "http://www.chat2konco.com";;
>         $url = "http://127.0.0.1:8080/wappush";;
>         $msisdn_pap = rawurldecode($msisdn);
>         $txt_pap = htmlspecialchars(rawurldecode($txt));
>         $smsc_id = "l7";
>
>         $body = "\r\n\r\n".
>                 "--asdlfkjiurwgasf\r\n".
>                 "Content-type: application/xml\r\n\r\n".
>                 "<?xml version=\"1.0\"?>".
>                 "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 2.0//EN\"".
>                 "\"http://www.wapforum.org/DTD/pap_2.0.dtd\";;>".
>                 "<pap product-name=\"Aloww! Chat\">".
>                         "<push-message push-id=\"ABC032\" 
> progress-notes-requested=\"false\">".
>                                 "<address
> address-value=\"WAPPUSH=".$msisdn_pap."/[EMAIL PROTECTED]"/>".
>                                         "<quality-of-service 
> priority=\"high\" delivery-method=\"unconfirmed\"
> network-required=\"true\" bearer-required=\"true\" network=\"GSM\"
> bearer=\"SMS\">".
>                                         "</quality-of-service>".
>                         "</push-message>".
>                 "</pap>\r\n\r\n".
>                 "--asdlfkjiurwgasf\r\n".
>                 "Content-type: text/vnd.wap.si\r\n\r\n".
>                 "<?xml version=\"1.0\"?>".
>                 "<!DOCTYPE si PUBLIC \"-//WAPFORUM//DTD SI 1.0//EN\"".
>                 "\"http://www.wapforum.org/DTD/si.dtd\";;>".
>                 "<si>".
>                         "<indication action=\"signal-medium\"
> href=".$link.">".$txt_pap."</indication>".
>                 "</si>\r\n\r\n".
>                 "--asdlfkjiurwgasf\r\n\r\n";
>
>         $header[] = "MIME-Version: 1.0";
>         $header[] = "X-Kannel-SMSC: $smsc_id";
>         $header[] = "Content-type: multipart/related; 
> boundary=--asdlfkjiurwgasf;
> type=application/xml";
>         $header[] = "Accept: text/xml";
>         $header[] = "Content-length: ".strlen($body);
>         $header[] = "Cache-Control: no-cache";
>         $header[] = "Connection: close \r\n";
>         $header[] = $body;
>
>         $ch = curl_init();
>         curl_setopt($ch, CURLOPT_URL,$url);
>         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>         curl_setopt($ch, CURLOPT_TIMEOUT, 5);
>         curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
>         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
>         $getResult = curl_exec($ch);
>         curl_close($ch);
> ?>
>
> but when i executed my source code in kannel show the messages "Unable to
> parse mime content", anyone  can help me?
> --
> View this message in context: 
> http://www.nabble.com/http-request-for-wap-push-tf4650767.html#a13287288
> Sent from the Kannel - User mailing list archive at Nabble.com.
>
>
>

Reply via email to