Anyone configured a 2 way sms script to send wap push message?

Anyone configured a 2 way sms script to send wap push message? SearchSearch
Author Message
Ali
Unregistered guest
Posted on Thursday, April 29, 2004 - 01:57 am:   

Hi has anybody configured a 2 way sms to send wap push message in ASP or PHP, I am stuck and really need somebodys help. If somebody can send there script or how to that will help a lot. Thanx a mill in advance
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2428
Registered: 10-2002
Posted on Thursday, April 29, 2004 - 09:02 pm:   

Hi Ali,

Assuming that you are in a 2-way script...

Take the second example in the following thread (2way-redirect.php).

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

Instead of "&text=", insert "&wapurl=".

And instead of ...

urlencode("I received your message : " . $_REQUEST['text'])

Use ...

urlencode ("http://wap.oa.yahoo.com")


This example is going to reply back with a WAP push to the Yahoo WAP portal ... which is probably enough to get you started.

If you are not working from within a 2-way command, it would be pretty easy to modify sendsms.php from this thread: http://support.nowsms.com/discus/messages/1/867.html

I didn't try this code, but this should work:

<?

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

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

fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&WAPURL=" . rawurlencode($wapURL) . " 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", "+4499999999", "http://wap.oa.yahoo.com");
echo $x;