1.11M Members

How to add UDH to concatenate a long sms before sending to API

 
0
 

I've been all over looking for how to get this done. below is the script I use to parse sms to my provider's API.however I've been having issues deliver a more than one page sms. I later found out there's need to add a UDH to each page to concatenate the pages. Pls can Kind people here tell me how to do that in php as I've not developed my php up to that level. Thanks

$phone = substr($phone, 0, strlen($phone)-1); 

$message = mysql_real_escape_string($_POST['message']); 
$sender = $_POST['sender']; 
$url1 = "../sms/send_sms.php?"; 
//initialize the request variable 

$request = ""; 

$param["?username"] = ""; 

$param["password"] = ""; 
//this is the message that we want to send 
$param["message"] = $message; 
//these are the recipients of the message 
$param["mobile"] = $phone; 
//this is our sender 
$param["sender"] = $sender; 
//traverse through each member of the param array 
foreach($param as $key=>$val){ 
    //we have to urlencode the values 
    $request.= $key."=".urlencode($val); 
    //append the ampersand (&) sign after each paramter/value pair 
    $request.= "&"; 
} 
//remove the final ampersand sign from the request 
$request = substr($request, 0, strlen($request)-1);  


$url = "http://sms.bulksms.com/bulksms/bulksms.php";  



$ch = curl_init(); 

//initialize curl handle  

curl_setopt($ch, CURLOPT_URL, $url.$request);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 

//set the url 
date_default_timezone_set('Africa/Lagos'); 
$time= date('H:i:s'); 
$today = date("Y-m-d"); 

//return as a variable  



//set POST method  


//set the POST variables 

$response = curl_exec($ch); 
//close the curl handle 
if( $response == 1801){ 
    $response = "Message sent successfully";} 
    elseif ($response == 1802){ 
    $response = "Invalid username";} 
    elseif ($response == 1803){ 
    $response = "Invalid Password";} 
    elseif ($response == 1809){ 
    $response = "Message Empty";} 
    else{$response = "Message not sent";} 

$sql= "INSERT INTO sent VALUES('','$today','$time','$message','$response','$phone')"; 
$result= mysql_query($sql) or die(mysql_error()); 
//run the whole process and return the response 

curl_close($ch);
 
0
 

This should be provided by your API (bulksms in your case). I advise you contact them, or perhaps it is in their documentation.

 
0
 

This should be provided by your API (bulksms in your case). I advise you contact them, or perhaps it is in their documentation.

That's what I thought. But they keep saying I should contact my developer, so I thought it's something I have to do to my code

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article