We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,521 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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

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);
2
Contributors
2
Replies
3 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
jerry4all
Newbie Poster
2 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

pritaeas
Posting Prodigy
Moderator
9,546 posts since Jul 2006
Reputation Points: 1,194
Solved Threads: 1,495
Skill Endorsements: 98

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

jerry4all
Newbie Poster
2 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0628 seconds using 2.69MB