|
Ok.
Just a few cuts from my scripts
(php) :
To encode mnc/mcc from usual values:
$code.=substr($mcc,1,1);
$code.=substr($mcc,0,1); $code.="F"; $code.=substr($mcc,2,1); $code.=substr($mnc,1,1); $code.=substr($mnc,0,1); Now the binary data codings :
function symbolize($input)
{ /*this gets a hex string and puts "%" after every second
char*/
$len = strlen($input); $i=0; for ($j=0;$j<$len;$j=$j+2){ $char .= "%" ; $char .= substr($input, $j, 1); $char .= substr($input, $j+1, 1); } return ($char); } function http_send($URL,$port)
{ $connection = fsockopen(BEARERBOX_HOST,$port,&$error_number,&$error_description,60); if(!$connection) { // echo "<p>$error_description ($error_number)<br>\n"; // echo "The SMS message was NOT sent!</p>\n"; } else { fputs($connection, "GET $URL HTTP/1.0\r\n\r\n"); while (!feof($connection)) { $myline = fgets($connection, 128); switch($myline) { case (strstr($myline, 'Content-')): break; case (strstr($myline, 'HTTP/1')): break; case "": break; case "\r\n": break; default: echo "\n"; } } fclose ($connection); }
} switch ($type)
{ case "text": $udh=""; break; case "clean": $udh="&udh=".symbolize("06050415820000"); $text="00000000000001"; break; case "operator": $udh="&udh=".symbolize("06050415820000"); $text=$code."00480E01".$text; break; case "group": $udh="&udh=".symbolize("06050415830000"); $text="00480E01".$text; break; case "profile": $len=strlen($text); $count=ceil($len/257); for ($i = 1; $i <= $count; $i++) { $temp = substr($text,256*($i-1),256*$i); $data="symbolize($temp); $udh="&udh="; $temp="0B0504158A00000003010".$count."0".$i; $udh.=symbolize($temp); $URL="/cgi-bin/sendsms?username=".USERNAME."&smsc=$smsc&password=".PASSWORD."&to=$to$udh&text=$data"; $URL.="&from=A38700&validity=$validity&priority=$priority&app_id=$sql_id"; http_send($URL,$port);
}
exit; break; case "ringtone": $len=strlen($text); $count=ceil($len/257); for ($i = 1; $i <= $count; $i++) { $temp = substr($text,256*($i-1),256*$i); $data="symbolize($temp); $udh="&udh="; $temp="0B0504158100000003AA0".$count."0".$i; $udh.=symbolize($temp); $URL="/cgi-bin/sendsms?username=".USERNAME."&smsc=$smsc&password=".PASSWORD."&to=$to$udh&text=$data"; $URL.="&from=A38700&validity=$validity&priority=$priority&app_id=$sql_id"; http_send($URL,$port); } exit; break; case "picture": $len=strlen($text); $count=ceil($len/257); for ($i = 1; $i <= $count; $i++) { $temp = substr($text,256*($i-1),256*$i); $data="symbolize($temp); $udh="&udh="; $temp="0B0504158A00000003010".$count."0".$i; $udh.=symbolize($temp); $URL="/cgi-bin/sendsms?username=".USERNAME."&smsc=$smsc&password=".PASSWORD."&to=$to$udh&text=$data"; $URL.="&from=A38700&validity=$validity&priority=$priority&app_id=$sql_id"; http_send($URL,$port); } exit; break; case
"vcard":
$udh="&udh=".symbolize("06050423F40000"); break; case "vcalendar": $udh="&udh=".symbolize("0B050423F5000000"); break; } if ($udh) $data="symbolize($text); else $data="urlencode($text); " Hope this helps someone.
Bye.
|
- php-admin/send*.php Miguel Vitorino
- Re: php-admin/send*.php Steve Rapaport
- Re: php-admin/send*.php Alexei Pashkovsky
- Re: php-admin/send*.php Alexei Pashkovsky
