MY-API-KEY-1234
See PHP HTTP API steps below;
1. Copy and paste this PHP function:
function sendSMS ($sender, $message , $destination, $dnd, $apikey){ $sender = urlencode($sender); $message = urlencode($message); $destination = str_replace(' ', '', $destination); $destination = urlencode($destination); $live_mebo_url = "http://mebosms.com/api?apikey=".$apikey."&sender=".$sender."&dnd=".$dnd."&mssg=".$message."&destination=".$destination; $parse_mebo_url= file($live_mebo_url); $numm = count($parse_mebo_url); $numm = $numm-1 ; $reports = $parse_mebo_url[$numm]; return $reports ; }
2. Call the function as show in the example below;
$sender = "SENDER"; //Sender name (with spaces) should not be more than 11 characters (Avoid use of special characters) $message = "THIS IS MY MESSAGE"; $destination = "THIS IS MY PHONE NUMBER"; $dnd = "INPUT EITHER 0 OR 1"; //1: Deliver to DND numbers, 0: Don't deliver to DND Numbers $apikey = "COPY AND PASTE API KEY HERE"; $sendd = sendSMS($sender, $message, $destination, $dnd, $apikey);
3. Pull reports from the function with json as shown below;
/* $send will return four array keys */ /*NOTE: if $send is blank, then you do not have SMS credits left */ $send = json_decode($sendd, true); /*1.*/ $send['delivered']; // Number of messages delivered /*2.*/ $send['notDelivered']; // Number of messages NOT delivered /*3.*/ $send['badNumber']; // Number of bad phone numbers /*4.*/ $send['total']; // Total number of messages sent /*5.*/ $send['sentID']; // The unique ID number to track each message
4. Pull status of message sent with http api as shown below;
/* Login to view */
See Java API steps below;
1. Copy and compile this Java function:
public static String sendSMS(String sender, String message, String destination, String dnd, String apikey) { String webPage; try { webPage = "http://mebosms.com/api?apikey=" + apikey + "&destination=" + URLEncoder.encode(destination, "UTF-8") + "&mssg=" + URLEncoder.encode(message, "UTF-8") + "&sender=" + URLEncoder.encode(sender, "UTF-8") + "&dnd=" + dnd; } catch (UnsupportedEncodingException e) { return "UnsupportedEncodingException"; } try { URL url = new URL(webPage); URLConnection urlConnection = url.openConnection(); InputStream is = urlConnection.getInputStream(); InputStreamReader isr = new InputStreamReader(is); int numCharsRead; char[] charArray = new char[1024]; StringBuffer sb = new StringBuffer(); while ((numCharsRead = isr.read(charArray)) > 0) { sb.append(charArray, 0, numCharsRead); } int indexOfJsonString= sb.indexOf("{"); String result = indexOfJsonString==-1 ? sb.toString().trim(): sb.substring(sb.indexOf("{")).trim(); return result; } catch (Exception e) { return "MalformedURLException"; } }
2. Call the function as show in the example below;
public static void main(String[] args) { // Example of use [Sending SMS] String $sender = "SENDER"; //Sender name (with spaces) should not be more than 11 characters (Avoid use of special characters) String message = "THIS IS MY MESSAGE"; String destination = "THIS IS MY PHONE NUMBER"; String dnd = "INPUT EITHER 0 OR 1"; //1: Deliver to DND numbers, 0: Don't deliver to DND Numbers String apikey = "COPY AND PASTE API KEY HERE"; String response = sendSMS( sender, message, destination, dnd, apikey); System.out.println( response ); }
3. Pull reports from the function with json as shown below;
/* response will return a JSON output array keys */ /*NOTE: if response is blank, then you do not have SMS credits left */ //Use a JSON library to read the Json OUTPUT JSONObject jSONObject = new JSONObject(response); jSONObject.getInt("delivered"); // Number of messages delivered jSONObject.getInt("notDelivered"); // Number of messages NOT delivered jSONObject.getInt("badNumber"); // Number of bad phone numbers jSONObject.getInt("noCredit"); jSONObject.getInt("dndNumber"); jSONObject.getInt("total"); // Total number of messages sent jSONObject.getString("fullReport"); jSONObject.getString("messageID"); jSONObject.getString("sentID"); // The unique ID number to track each message
4. Pull status of message sent with http api as shown below;
/* Login to view */
That's pretty much all. It's that simple!
No credit card or payment details required