Tutorials

SENDING SMS

SENDING SMS

Using HTTP

Overview

This method provides a way to send the message (SMS) via HTTP using account details.

Send SMS through your application by making an HTTP GET request to the following endpoints:

HTTP Request Parameters

These are the standard request parameters that are needed when using the HTTP method of the EgoSMS Api.

The parameters should be separated using the ‘&’ sign just like in a normal http get.

username String Required

The API callers username used to login to Egosms.

password String Required

The URL encoded password to your Ego Sms Account

number String Required

The phone number the message is being sent to.

message String Required

This represents the URL encoded SMS you are sending out. The message source must have a maximum of 160 characters.

sender String Required

This represents who the message is coming from. Sender can have a maximum of 11 characters and needs to be URL encoded too.

PriorityString Optional

This represents level of priority. Priority can have values from (0-4) with  0: highest, 1: high, 2: Medium, 3: Low, 4: Lowest

Example

The above link will send a message “My first message through Egosms” to the number “256788200915” using and Egosms Account whose username is “EgosmsTest” and password “egotest”

System Feedback

Once your message has been successfully sent to the network the system will show ‘Ok’ otherwise it will show error.

Possible Errors

Error

Meaning

Wrong UserName Or Password

This is returned if either the provided password or username is wrong.

One Of The Values Is Empty

This is if returned any of the fields (username / password / number / message / ‘senderid) is empty.

Money Not Enough To Send This Batch of Msgs.

Occurs if there are insuffient funds of your Egosms Account.

That user does not exist or user not active

Occurs if the account being used does not exist or is  inactive or if the username is not set.

Programming Example

				
					function SendSMS($username, $password, $sender, $number, $message)
{

    $url = "www.egosms.co/api/v1/plain/?";

    $parameters = "number=[number]&message=[message]&username=[username]&password=[password]&sender=[sender]";
    $parameters = str_replace("[message]", urlencode($message) , $parameters);
    $parameters = str_replace("[sender]", urlencode($sender) , $parameters);
    $parameters = str_replace("[number]", urlencode($number) , $parameters);
    $parameters = str_replace("[username]", urlencode($username) , $parameters);
    $parameters = str_replace("[password]", urlencode($password) , $parameters);
    $live_url = "https://" . $url . $parameters;
    $parse_url = file($live_url);
    $response = $parse_url[0];
    return $response;
}
$username = "Egosmstest";
$password = "egotest";
$sender = "Egosms";
$number = "+256788200915";
$message = "My First Message through Egosms";
echo SendSMS($username, $password, $sender, $number, $message);