SMS and MMS references

SMS and MMS references SearchSearch
Author Message
Wahono
Unregistered guest
Posted on Sunday, November 30, 2003 - 07:05 am:   

Hi, Mr. Bryce. This gateway very easy to use for send sms. But right now i need the reference of sms format that your gateway use. There is wap push send on this gateway, I'm now trying to build wap site with php, I'm work in mobile but i don't know what php script for wap push that can communicate with your gateway. Could you please send me the php script for wap push? Thank's.
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 1290
Registered: 10-2002
Posted on Monday, December 01, 2003 - 06:40 pm:   

Hi Wahono,

If you are using sendsms.php from the following thread:

http://support.nowsms.com/discus/messages/1/867.html

Then it is a relatively simple modification to do WAP push. A word of warning, I have not had the time to test the attached script, so I might have a minor error in it ... but this should be close:

<?

function SendWAPPush ($host, $port, $username, $password, $phoneNoRecip, $msgText, $pushURL) {

$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp) {
echo "errno: $errno \n";
echo "errstr: $errstr\n";
return $result;
}

fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" . rawurlencode($msgText) . "&WAPURL=" . rawurlencode($pushURL) . " HTTP/1.0\n");
if ($username != "") {
$auth = $username . ":" . $password;
echo "auth: $auth\n";
$auth = base64_encode($auth);
echo "auth: $auth\n";
fwrite($fp, "Authorization: Basic " . $auth . "\n");
}
fwrite($fp, "\n");

$res = "";

while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);


return $res;
}



$x = SendWAPPush("127.0.0.1", 81, "username", "password", "+44999999999", "Test Push", "http://www.domain.com/content.url");
echo $x;


?>

text/plainSendWAPPush.php
sendwappush.php (1.0 k)