Something Interesting to do with SMS's

idalatob

Member
Joined
Oct 22, 2007
Messages
13
Reaction score
0
Hey I found out that you can send sms's for much cheaper than the 80 odd cents vodacom charges. Theres a cool service called panaceamobile which lets you send at a flat rate of 24 cents per sms. Pretty swangoes if you ask me. I'll attach the api, or you could just log into their site (www.panaceamobile.com:
PHP:
<?php

function send_message($username, $password, $from, $to, $message, $track_delivery = 0) {
	$url = "http://api.panaceamobile.com/sendsms?1";
	$data = array(
		"to" => $to,
		"from" => $from, 
		"dlr-mask" => $track_delivery,
		"text" => $message,
		"username" => $username,
		"password" => $password
	);
		
	foreach($data as $key => $val) {
		$data[$key] = urlencode($val);
	}



	$str = $url;
	foreach($data as $key => $val) {
		$str .= "&{$key}={$val}";
	}

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $str);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$res = curl_exec($ch);

	if($res !== FALSE) {
		if(
		(strpos($res, "Accepted") === FALSE) &&
		(strpos($res, "Queued") === FALSE) &&
		(strpos($res, "Sent") === FALSE)
		)
		return false;
		return true;
	}
	return false;
}

$to = "44325321234";
$from = "4432532021";


if(send_message("myusername", "mypassword", $to, $from, "Hello Messaging!", 1)) {
	echo "Message Sent!";
} else {
	echo "Message Failed!";
}


?>
dont want to spam you guys but I just thought some of you ouens might be interested.
 
Top
Sign up to the MyBroadband newsletter
X