Dear kannel list members.
I want to send from number ( i.e 300,
500) dynamically using wappush , I am using bellow mentioned script .
please guide me how can I sender number.
--------------------------- php core -------------------------
<?
$country_code = $_REQUEST["cc"];
$phone = $_REQUEST["ph"];
$push_url = $_REQUEST["url"];
$text = $_REQUEST["msg"];
$smsc_id = $_REQUEST["smsc"];
send_wap_push($smsc_id, $country_code, $phone, $url, $text);
function function_that_generates_a_unique_id()
{
return |md5(uniqid(rand(), true));
}
function send_wap_push($smsc_id, $country_code, $phone, $push_url, $text)
{
$host = '127.0.0.1:';
$port = '8080';
$url = "http://$host:$port";
$ppg_user = 'xxxx';
$ppg_pass = 'xxxx';
$wap_push_id = function_that_generates_a_unique_id(){
return |md5(uniqid(rand(), true));|
}
$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.'/TYPE=PLMN <at>
ppg.nokia.com"/>'."\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"."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);
}
?>
--------------------------------//php
code-------------------------------------
Best regards,
Kashif Ali Bukhari