shortcode_send-200x120
Recently we posted an article about how to receive messages using the SMS Shortcode Service. In this post, we will do the opposite and show you how to send messages using SMS Shortcodes. The reason to use shortcode messaging is because of the rules of using direct SMS messages do not permit you to automate sending bulk messages via regular SMS messaging. Sending shortcode messages is often used for sending payment reminders, resetting passwords, and emergency notifications (used in many schools these days).
The SMS API Command we will be using is the sendshort command. The parameters for the API call are:

Optional
Command
Description Required to Function What to Send
src Source short code (99629) to send from Yes, Must be present An integer/number
dst Destination USA Number to send to Yes, Must be present An integer/number
msg The message to send Yes, Must be present a-z,0-9
xml Sending xml=yes will return your results as XML instead of plain txt Not required yes
Link / URL to connect to
http://smsout-api.vitelity.net/api.php?login=ApiLogin&pass=APIPassword&cmd=sendshort&src=ShortCode&dst=DestPhoneNumber&msg=MessageString

Note: Replace anything in bold with the appropriate data

You will need your API login and password from your user portal and be running the command from an IP address you have already authorized. For our example, we will use the following credentials:
API Login: Tech_API_1
API Password: MyAPIpa$$word
The simplest was to demonstrate how to use the API is with a working piece of PHP code:
ShortCode.php

<?php
// create a new cURL resource$ch = curl_init();
// Set API credentials
$login = "Tech_API_1";
$password = "MyAPIpa$$word";
// Set SRC ShortCode and Destination Phone Number
$src = "99629";
$dest = "9495551234";
// URL Encode the message string
$msg = urlencode("Your bill is past due, please log into your portal and make a payment immediately to avoid service interruption.");
// Build the API command string
$cmd = "http://smsout-api.vitelity.net/api.php?login=$login&pass=$password&cmd=sendshort&src=$src&dst=$dest&msg=$msg&xml=yes";
// set URL and other appropriate options
// Send API command and clean up
curl_setopt($ch, CURLOPT_URL, "$cmd");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// grab URL and pass it to the browser
// Print response
$response = curl_exec($ch);
echo "$response\n";
// close cURL resource, and free up system resources
curl_close($ch);
?>

Make sure sendshort.php has proper execution permissions and then you can run it from the command line as follows:
php sendshort.php
If there are no problems with the script, you should get the following response:

<?xml version="1.0" encoding="UTF-8"?>
<content>
<status>ok</status>
<response>ok</response></content>

If all goes well with the script, the message will be delivered to the SMS gateway and should be received by the receiving phone number within a few seconds. By default, we do limit the number of messages per day to prevent abuse and bad scripts. If you develop an application and need to be able to send bulk messages, please contact sales to have the limit changed.
If you do something really interesting with SMS or shortcode messaging, please let us know so we can do a case study about it.