160) {
$totalMsgPartsNo=ceil(strlen($message)/153);
$totalMessagePartsNoHex=dechex($totalMsgPartsNo);
if(strlen($totalMessagePartsNoHex) == 1) $totalMessagePartsNoHex = "0".$totalMessagePartsNoHex;
$identifyCode = rand(0, 255);//generate randon decimal number from range 0 to 255
$identifyCodeHex=dechex($identifyCode);//converts from decimal to hexadecimal; 2 digit, so range is 16= 10 ; ff=255
$messageCharacterIndexStart=0;
for ($i = 1 ; $i <= $totalMsgPartsNo; $i++) {
$messagePart=substr($message,$messageCharacterIndexStart,153);
$messageCharacterIndexStart += 153;
$currentMessagePartsNoHex=dechex($i);
if(strlen($currentMessagePartsNoHex) == 1) $currentMessagePartsNoHex = "0".$currentMessagePartsNoHex;
//Sample UDH: 0500032F0201
$UserHeader = '050003'.$identifyCodeHex.$totalMessagePartsNoHex.$currentMessagePartsNoHex;
$messageUrlencoded = urlencode($messagePart);
$params ="ID=$ID&Password=$Password&Mobile=$mobileNumber&Type=$Type&UserHeader=$UserHeader&Message=$messageUrlencoded";
$send=curl_string($urlPage,$userAgent,$params);
echo "POST STRING: $urlPage?$params
Result: $send
";
}
}
else{
$messageUrlencoded = urlencode($message);
$params ="ID=$ID&Password=$Password&Mobile=$mobileNumber&Type=$Type&Message=$messageUrlencoded";
$send=curl_string($urlPage,$userAgent,$params);
echo "POST STRING: $urlPage?$params
Result: $send
";
}
?>