Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $to = $_GET['to'];
- $msg = $_GET['sms'];
- echo "message is ". rawurlencode($msg);
- //echo "message is".$msg;
- //$to = "639189906040";
- $str = $msg;
- function utf8_to_unicode($str) {
- $unicode = array();
- $values = array();
- $lookingFor = 1;
- for ($i = 0; $i < strlen($str); $i++) {
- $thisValue = ord($str[$i]);
- if ($thisValue < 128)
- $unicode[] = str_pad(dechex($thisValue), 4, "0", STR_PAD_LEFT);
- else {
- if (count($values) == 0) $lookingFor = ($thisValue < 224) ? 2 : 3;
- $values[] = $thisValue;
- if (count($values) == $lookingFor) {
- $number = ($lookingFor == 3) ?
- (($values[0] % 16) * 4096) + (($values[1] % 64) * 64) + ($values[2] % 64):
- (($values[0] % 32) * 64) + ($values[1] % 64);
- $number = strtoupper(dechex($number));
- $unicode[] = str_pad($number, 4, "0", STR_PAD_LEFT);
- $values = array();
- $lookingFor = 1;
- } // if
- } // if
- } // for
- return ($unicode);
- } // utf8_to_unicode
- $hexArray = utf8_to_unicode($str);
- $output = implode("", $hexArray);
- $user = "highway54";
- $password = "RnaQi3LDur";
- $api_id = "3445509";
- $baseurl ="http://api.netvoice.com.ph/ameyosms/sendsms.php";
- $unicode = "1NetVoice";
- //$text = urlencode("This is Test");
- //$text = "$sms";
- //$to = "$phone";
- //auth call
- //$url = "$baseurl/bulksms/bulksms?username=$user&password=$password&type=6&dlr=0&destination=$to&source=novatelsms&message=$message";
- $url = "$baseurl?user=$user&password=$password&api_id=$api_id&to=$to&text=$output&unicode=$unicode";
- echo $url;
- // do auth call
- $ret = file($url);
- // explode our response. return string is on first line of the data returned
- $sess = explode(":",$ret[0]);
- if ($sess[0] == "OK") {
- $sess_id = trim($sess[1]); // remove any whitespace
- //$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
- // do sendmsg call
- $ret = file($url);
- $send = explode(":",$ret[0]);
- if ($send[0] == "ID") {
- echo "successnmessage ID: ". $send[1];
- } else {
- echo "send message failed";
- }
- } else {
- echo "NetVoice Response: ". $ret[0];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement