Information Technology Articles :: SEO Tips :: WAP Articles :: Search Engine Marketing :: Internet Tips

Goedangilmu

Script Request WAP PUSH

Posted on January 9th, 2008 in Programming, 614 views

Script yang akan saya sajikan dibawah ini menggunakan metode HTTP Get yang di integrasikan dengan PHP, script ini nantinya akan diarahkan ke SMS Gateway.

Berikut ini contoh script untuk melakukan request WAP PUSH ke Kannel WAP/SMS Gateway.

$kannel = array (host => ‘127.0.0.1′,port => 13013,user => ‘foo’,pass => ‘bar’);

$fields = array (smsc => ‘l7′);

function WAPpsh($url, $vendor)

{

$text .= “%01″; # Transaction ID

$text .= “%06″; # PDU Type (push)

$text .= “%04″; # Headers Length (content-type + headers)

$text .= “%03″; # Length of content type

$text .= “%AE”; # Content-Type: application/vnd.wap.sic

$text .= “%81″; # Charset

$text .= “%EA”; # UTF-8 # End Headers # si_binary_output

$text .= “%02″; # Version number (wbxml_version)

$text .= “%05″; # Unknown Public Identifier (si_public_id)

$text .= “%6A”; # charset= (sibxml->charset)

$text .= “%00″; # String table length

$text .= “%45″; # <si>

$text .= “%C6″; # <indication…

$text .= “%0B”.”%03″.rawurlencode($url).”%00″; # href=$url

$text .= “%08″; # action=”signal-high”

$text .= “%01″; # end indication params

$text .= “%03″.rawurlencode($vendor).”%00″;

$text .= “%01″; # </indication>

$text .= “%01″; # </si> return $text;

}

$text = WAPpsh(”www.chat2konco.com”,”Anda Memiliki Pesan Baru”);

$fields[udh] = “%06%05%04%0B%84%23%F0″;

$fields[text] = $text;

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].”&to=”.$to.”".$string);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $result);

curl_setopt($ch, CURLOPT_TIMEOUT, 5);

$getResult = curl_exec($ch);

Related Posts :

Published by Adith

2 Comments

  1. iron_maiden on 23.01.2008 at 03:48 (Reply)

    tolongin gw dunk,gw lagi skripsi bikin wap pakai wml tapi pake php. gw bikin aplikasi pariwisata di jawa tengah.

  2. krisna on 10.03.2008 at 17:19 (Reply)

    makasih mas Adith, saya sudah coba scriptnya dan dengan sedikit modifikasi saya bisa kirim SMS dan langsung mendapat balikan WAP Push (^_^). Udah hampir seminggu nyobain kannel ini he..he.he.he.. at last..
    Thx

Leave a comment