Example of iOS Phone Sample SMS Code - Messaging API

//IOS SMS API integration code //Create Objects NSMutableData * responseData; NSURLConnection * connection; // In your viewDidLoad method add this lines -(void)viewDidLoad { [super viewDidLoad]; //Your application url NSString * ApiUrl = @"ApiUrl"; //Multiple mobiles numbers separated by comma NSString * user = @"uname"; NSString * pass = @"******"; NSString * mobiles = @"9999999"; //Sender ID,While using route4 sender id should be 6 characters long. NSString * sid = @"102234"; //Your message to send, Add URL encoding here. NSString * message = @"Test message"; // Prepare your url to send sms with this parameters. NSString * url = [[NSString stringWithFormat:@"https://broadnet.me/api/xxxxx.php?user=%@&pass=%@&mobiles=%@&message=%@&sid=%@", user, pass, mobiles, message, sid] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; } // implement URLConnection Delegate Methods as follow -(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { //Get response data responseData = [NSMutableData data]; } -(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [responseData appendData:data]; } -(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"message:error.localizedDescription delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [alert show]; } -(void) connectionDidFinishLoading:(NSURLConnection *)connection { // Get response data in NSString. NSString * responceStr = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; }
BroadNet Technologies lends a great help to you in sending messages to your contacts via the following iOS phone sample SMS code.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.