Developers

SMS API Interface

Example scripts in PHP – Examples of sending SMS messages in PHP

Download full Gretor SMS specification v2.1

Attention! Password have to be encrypted using MD5!

Example no 1 – SMS sends directly using PHP.

<?php

$username = “username”;

$password = md5(“password”);

$to = “30123456789”;

$from = “name”; // sender name have to be activated

$message= urlencode(“My message”);

if ($username && $password && $to && $message)

?>

Example no 2 – SMS sends from HTML form using PHP.

<?php

if (strlen($_POST[‘sms_from’])>0 &&

strlen($_POST[‘sms_message’])>0)

?>

<html>

<body>

<form name=”sms” method=”POST” action=””>

<table>

<tr>

<td>From:</td>

<td><input type=”text” name=”sms_from” value=””></td>

</tr>

<tr>

<td>To:</td>

<td><input type=”text” name=”sms_to” value=””></td>

</tr>

<tr>

<td>Message:</td>

<td><textarea name=”sms_message”></textarea></td>

</tr>

<tr>

<td colspan=”2″><input type=”submit” value=”send”></td>

</tr>

</table>

</form>

</body>

</html>

Example no 3 – Mass SMS sends using cURL library.

<?php

$username = ‘user’;

$password = md5(‘pass’);

$from = ‘Yourname’;

$to = array(‘number1′,’number2’);

$message = urlencode(‘Test message’);

echo send_sms($username,$password,$from,$to,$message);
function send_sms($username,$password,$from,$to,$message)

?>

API Error codes and message delivery statuses

Message delivery statuses

Number Status Description
401 NOT_FOUND Wrong ID or report has expired.
402 EXPIRED Messages expired.
403 SENT Message is sent.
404 DELIVERED Message is delivered to recipient.
405 UNDELIVERED Message is undelivered (invalid number, roaming error etc).
406 FAILED Sending message failed – please report it to us.
408 UNKNOWN No report (message may be either delivered or not).
409 QUEUED Message is waiting to be sent.
410 ACCEPTED Message is delivered to operator.

API Error Codes

Error code Description
8 Error in request (Please report)
11 Message too long or there is no message or parameter nounicode is
set and special characters (including Polish characters) are used.
12 Message has over 160 chars when parameter &smp;single=1.
13 Lack of valid phone numbers (invalid or blacklisted numbers).
14 Invalid sender name.
17 FLASH message cannot contain special characters.
18 Invalid number of parameters.
19 Too many messages in one request.
20 Invalid number of IDX parameters.
27 Too long IDX parameter. Maximum 255 chars.
30 Wrong UDH parameter when &datacoding=bin
40 No group with given name in phonebook.
41 Chosen group is empty.
50 Messages may be scheduled up to 3 months in the future.
52 Too many attempts of sending messages to one number (maximum 10
attempts whin 60s).
53 Not unique idx parameter, message with the same idx has been already
sent and &check_idx=1.
54 Wrong date format (only unix timestamp and ISO 8601) when
&date_validate=1.
56 The difference between date sent and expiration date can’t be less
than 1 and more tha 12 hours.
57 Recipient\’s number is on blacklist.
70 Invalid CALLBACK address in notify_url parameter.
72 Parameter notify_url may be used only for single request (cannot be
used for bulk submissions).
74 Date of sent is outside allowed timeframe set for this user.
101 Invalid authorization info. ATTENTION! API password
ma be different than web panel password.
102 Invalid username or password.
103 Insufficient credits on Your account.
104 No such template.
105 Wrong IP address (for IP filter turned on).
200 Unsuccessful message submission, please repeat zour request.
201 System internal error (please report).
202 Too many simultaneous request, message won’t be sent.
300 Invalid parameter &points value, &points=1 expected.
301 ID of messages doesn’t exist.
400 Invalid message ID of a status response.
999 System internal error (please report).
4000 General Phonebook error.
4001 Action not available for this account.
4002 Invalid action.
4003 Invalid parameter usage.
4004 Too large limit parameter value (i.e. for list_contacts action
maximum value is 200).
4100 General groups’ action error.
4101 Group not found.
4110 General group’s name error.
4111 Invalid group’s name.
4112 Group’s name musn’t be empty.
4113 Group’s name too short (min 2 chars).
4114 Group’s name too long (max 32 chars).
4115 Forbidden chars appeard in group’s name.
4116 Group already exists.
4121 Invalid Info field value for groups.
4122 Too long Info field value for contact (max 200 chars).
4200 General contact error.
4201 Contact not found.
4210 General phone number error.
4211 Invalid phone number.
4212 Contact has to contain phone number.
4213 Phone number is too short.
4214 Phone number is too long.
4220 First name error.
4221 First name too short (min 2 chars).
4222 First name too long (max 100 chars).
4230 Last name error.
4231 Last name too long (min2 chars).
4232 Last name too long (max 100 chars).
4240 Contact Info ffield error.
4241 Too long Info field value for contact (max 200 chars).
4250 E-mail address error for this contact.
4260 Birth date error for this contact.
4270 Group error for this contact.
4271 Group not found.
4272 Group name is neccessary for group actions.
4280 Gender error.

SMPP Interface – SMPP Protocol

SMPP (Short Message Peer-to-Peer), is open standarized protocol designed to provide direct data communication between telecommunication system like Message Centres (SMSC) and Short Message Entities (SME/ESME) in order to send SMS messages between them. SMPP protocol is mostly used for communication with GSM operators and SMS aggregators (ESME SMSC).

SMPP protocol is based on binary encoded pairs request/response PDUs (protocol data units, or packets) exchanged over OSI layer 4 connections (transport layer). Message exchange may be synchronous, where each peer waits for a response for each PDU being sent, or asynchronous, where multiple requests can be issued without waiting and acknowledged in a skew order by the other peer; the number of unacknowledged requests is called a window; for the best performance both communicating sides must be configured with the same window size.

Communication system used in SMPP allows to send SMS message without using handsets, GSM modems or SIM cards. SMPP systems allows to use a number of features not available for standard GSM devices i.e. alphanumeric sender names instead of standard phone numbers.

For more details about SMPP accounts please contact us.

Email to SMS Interface

Description of E-Mail to SMS Interface

Using mail2SMS tool you will be able to send SMS in very easy way. You just need to send a properly created e-mail to sms.do@sms.gretor.com. As topic of e-mail username and password encrypted in md5 should be given. Content of e-mail should contain proper parameters.

Basic parameters:

Parameter Descrition Example values Additional informartions
from Sender name from=Gretor SMS Sender name must be active.
to Recipients’s number to=306931234***
raport Request to ger response e-mail raport=1 Response is sent back as e-mail message.
message Message content message=TEST It has appear as the last parameter!

Important information!

  • Messages may be sent in following encoding: plain / quotedprintable / base64.
  • Phone number MUST NOT contain plus char “+” at the beginning.
  • Parameter message MUST at the and of the e-mail message (as the last parameter).
  • Sender name (parameter from) MUST be active.

Examples

Example of sending SMS message.

ADRES: sms.do[at]sms.gretor.com.com
TEMAT: login@8456fkty567gb3bg37b357b3457b3457
TREŚĆ: from=Gretor SMS&to=30693123***&raport=1&message=MESSAGE CONTENT

Example of response to properly send SMS request.

ADRES: sms.do[at]sms.gretor.com
TEMAT: Response SMSAPI
TREŚĆ: Gretor SMS:30693123***:OK:message_id:cost

Example of response when error occured.

ADRES: sms.do[at]sms.gretor.com
TEMAT: Response Gretor SMS
TREŚĆ: Gretor SMS:306931234***:ERROR:error_code

7bit GSM alphabet – This is the 7 bit default alphabet as specified by GSM 03.38.

All chars outside this charset are considered to be special chars and causes shortening single message from 160 chars to 70 chars. Using only chars from this list won’t shorten the message.

Notice that characters ^ { } [ ] \ ~ | [enter] € are counted double when sending message without special chars because of GSM specification requirements.

Character Character name HEX DEC
@ COMMERCIAL AT 0x00 0
£ POUND SIGN 0x01 1
$ DOLLAR SIGN 0x02 2
¥ YEN SIGN 0x03 3
è LATIN SMALL LETTER E WITH GRAVE 0x04 4
é LATIN SMALL LETTER E WITH ACUTE 0x05 5
ù LATIN SMALL LETTER U WITH GRAVE 0x06 6
ì LATIN SMALL LETTER I WITH GRAVE 0x07 7
ò LATIN SMALL LETTER O WITH GRAVE 0x08 8
Ç LATIN CAPITAL LETTER C WITH CEDILLA 0x09 9
LINE FEED 0x0A 10
Ø LATIN CAPITAL LETTER O WITH STROKE 0x0B 11
ø LATIN SMALL LETTER O WITH STROKE 0x0C 12
CARRIAGE RETURN 0x0D 13
Å LATIN CAPITAL LETTER A WITH RING ABOVE 0x0E 14
å LATIN SMALL LETTER A WITH RING ABOVE 0x0F 15
Δ GREEK CAPITAL LETTER DELTA 0x10 16
_ LOW LINE 0x11 17
Φ GREEK CAPITAL LETTER PHI 0x12 18
Γ GREEK CAPITAL LETTER GAMMA 0x13 19
Λ GREEK CAPITAL LETTER LAMBDA 0x14 20
Ω GREEK CAPITAL LETTER OMEGA 0x15 21
Π GREEK CAPITAL LETTER PI 0x16 22
Ψ GREEK CAPITAL LETTER PSI 0x17 23
Σ GREEK CAPITAL LETTER SIGMA 0x18 24
Θ GREEK CAPITAL LETTER THETA 0x19 25
Ξ GREEK CAPITAL LETTER XI 0x1A 26
ESCAPE TO EXTENSION TABLE 0x1B 27
FORM FEED 0x1B0A 27 10
^ CIRCUMFLEX ACCENT 0x1B14 27 20
{ LEFT CURLY BRACKET 0x1B28 27 40
} RIGHT CURLY BRACKET 0x1B29 27 41
\ REVERSE SOLIDUS (BACKSLASH) 0x1B2F 27 47
[ LEFT SQUARE BRACKET 0x1B3C 27 60
~ TILDE 0x1B3D 27 61
] RIGHT SQUARE BRACKET 0x1B3E 27 62
| VERTICAL BAR 0x1B40 27 64
EURO SIGN 0x1B65 27 101
Æ LATIN CAPITAL LETTER AE 0x1C 28
æ LATIN SMALL LETTER AE 0x1D 29
ß LATIN SMALL LETTER SHARP S (German) 0x1E 30
É LATIN CAPITAL LETTER E WITH ACUTE 0x1F 31
SPACE 0x20 32
! EXCLAMATION MARK 0x21 33
\” QUOTATION MARK 0x22 34
# NUMBER SIGN 0x23 35
¤ CURRENCY SIGN 0x24 36
% PERCENT SIGN 0x25 37
& AMPERSAND 0x26 38
APOSTROPHE 0x27 39
( LEFT PARENTHESIS 0x28 40
) RIGHT PARENTHESIS 0x29 41
* ASTERISK 0x2A 42
+ PLUS SIGN 0x2B 43
, COMMA 0x2C 44
HYPHEN-MINUS 0x2D 45
. FULL STOP 0x2E 46
/ SOLIDUS (SLASH) 0x2F 47
0 DIGIT ZERO 0x30 48
1 DIGIT ONE 0x31 49
2 DIGIT TWO 0x32 50
3 DIGIT THREE 0x33 51
4 DIGIT FOUR 0x34 52
5 DIGIT FIVE 0x35 53
6 DIGIT SIX 0x36 54
7 DIGIT SEVEN 0x37 55
8 DIGIT EIGHT 0x38 56
9 DIGIT NINE 0x39 57
: COLON 0x3A 58
; SEMICOLON 0x3B 59
< LESS-THAN SIGN 0x3C 60
= EQUALS SIGN 0x3D 61
> GREATER-THAN SIGN 0x3E 62
? QUESTION MARK 0x3F 63
¡ INVERTED EXCLAMATION MARK 0x40 64
A LATIN CAPITAL LETTER A 0x41 65
B LATIN CAPITAL LETTER B 0x42 66
C LATIN CAPITAL LETTER C 0x43 67
D LATIN CAPITAL LETTER D 0x44 68
E LATIN CAPITAL LETTER E 0x45 69
F LATIN CAPITAL LETTER F 0x46 70
G LATIN CAPITAL LETTER G 0x47 71
H LATIN CAPITAL LETTER H 0x48 72
I LATIN CAPITAL LETTER I 0x49 73
J LATIN CAPITAL LETTER J 0x4A 74
K LATIN CAPITAL LETTER K 0x4B 75
L LATIN CAPITAL LETTER L 0x4C 76
M LATIN CAPITAL LETTER M 0x4D 77
N LATIN CAPITAL LETTER N 0x4E 78
O LATIN CAPITAL LETTER O 0x4F 79
P LATIN CAPITAL LETTER P 0x50 80
Q LATIN CAPITAL LETTER Q 0x51 81
R LATIN CAPITAL LETTER R 0x52 82
S LATIN CAPITAL LETTER S 0x53 83
T LATIN CAPITAL LETTER T 0x54 84
U LATIN CAPITAL LETTER U 0x55 85
V LATIN CAPITAL LETTER V 0x56 86
W LATIN CAPITAL LETTER W 0x57 87
X LATIN CAPITAL LETTER X 0x58 88
Y LATIN CAPITAL LETTER Y 0x59 89
Z LATIN CAPITAL LETTER Z 0x5A 90
Ä LATIN CAPITAL LETTER A WITH DIAERESIS 0x5B 91
Ö LATIN CAPITAL LETTER O WITH DIAERESIS 0x5C 92
Ñ LATIN CAPITAL LETTER N WITH TILDE 0x5D 93
Ü LATIN CAPITAL LETTER U WITH DIAERESIS 0x5E 94
§ SECTION SIGN 0x5F 95
¿ INVERTED QUESTION MARK 0x60 96
a LATIN SMALL LETTER A 0x61 97
b LATIN SMALL LETTER B 0x62 98
c LATIN SMALL LETTER C 0x63 99
d LATIN SMALL LETTER D 0x64 100
e LATIN SMALL LETTER E 0x65 101
f LATIN SMALL LETTER F 0x66 102
g LATIN SMALL LETTER G 0x67 103
h LATIN SMALL LETTER H 0x68 104
i LATIN SMALL LETTER I 0x69 105
j LATIN SMALL LETTER J 0x6A 106
k LATIN SMALL LETTER K 0x6B 107
l LATIN SMALL LETTER L 0x6C 108
m LATIN SMALL LETTER M 0x6D 109
n LATIN SMALL LETTER N 0x6E 110
o LATIN SMALL LETTER O 0x6F 111
p LATIN SMALL LETTER P 0x70 112
q LATIN SMALL LETTER Q 0x71 113
r LATIN SMALL LETTER R 0x72 114
s LATIN SMALL LETTER S 0x73 115
t LATIN SMALL LETTER T 0x74 116
u LATIN SMALL LETTER U 0x75 117
v LATIN SMALL LETTER V 0x76 118
w LATIN SMALL LETTER W 0x77 119
x LATIN SMALL LETTER X 0x78 120
y LATIN SMALL LETTER Y 0x79 121
z LATIN SMALL LETTER Z 0x7A 122
ä LATIN SMALL LETTER A WITH DIAERESIS 0x7B 123
ö LATIN SMALL LETTER O WITH DIAERESIS 0x7C 124
ñ LATIN SMALL LETTER N WITH TILDE 0x7D 125
ü LATIN SMALL LETTER U WITH DIAERESIS 0x7E 126
à LATIN SMALL LETTER A WITH GRAVE 0x7F 127

SMS signup arrow