Revision: 72367
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 2, 2017 23:23 by Broadnet
Initial Code
//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]; }
Initial URL
https://www.broadnet.me/developer-tools/sms-sample-code/ios-sample-code-sms.html
Initial Description
The following example of iOS Phone sample SMS code employs user-friendly object, with a basis on the HTTP API.
Initial Title
Example of iOS Phone Sample SMS Code - Messaging API
Initial Tags
phone, code, api, ios
Initial Language
iPhone