sms:key

Remote sms:key handler

Not sure which service might be the right one? Please visit our service comparison page!

Pay attention to off-the-shelf SMS scripts library as well.

Remote sms:key handler

In standard sms:key version our server is responsible for issuing and verifying passwords. Given the popularity of sms:key services among our clients, we've created a more flexible version of sms:key service for those of you who possess good knowledge of WEB programming. The benefits of remote sms:key version as oppose to a standard one are:
- All passwords are stored and processed on your side, thus allowing you to locally manage user sessions;
- you can manage the appearance, as well as to some extent functionality of the service;
- the service is most resistant to all sorts of attacks on our servers, network disruptions, etc.
- the possibility to pass the additional parameter in a message text. The additional parameter allows to identify which website section is paid for (it is convenient, in case if you use the same key for access to different sections or files, but every section or file is paid for separately by a user).

Note: To be able to use the remote handler version of the key, one must understand the overall principle of how the scripts work on server side, good knowledge of PHP, HTML and skills to work with databases. Support regarding script installation/configuration is not provided.

Implementation details

Message handler (Result URL) accepts the following parameters:

Parameter Type Description
country char(2) Two letters country code
provider char(16) Mobile carrier
key int Your sms:key ID service
pair char(10) Password generated by our server
timeout int The time limit of the generated password (pair) in minutes
limit int The number of times the password was activated
content char(128) Text message, following the ID of your service
cost_local float SMS-message cost in local currency
sign_v4 char(32) MD5-hash lines, consisting of combined through double colon ("::") parameters secret_code, key, pair, timeout, limit, content, country, cost_local, provider (in specified order), where secret_code is the secret key for your sms:key service

System requirements:

PHP >= 4.3

Supported DBMS:

MySQL - requires MySQL module setup
SQLite - equires SQLite module setup
PDO:SQLite (object-oriented version) – requires PDO and SQlite modules setup (usually set on PHP >= 5.1)

Installation process:

1. extract the files
2. change /lib/config.php
3. set write permission to /lib/keys_db
4. set write permission to /lib/local.xml
5. run setup.php and uninstall it
6. run cron.php
7. customize your script according to the example in check.php (can be uninstall afterwards)
8. configure the key in control panel defining the full path to result.php and secret password as specified in configuration file.

File Pack

/lib/config.php – configuration file which includes basic functions
/lib/keys_db – the base itself
/lib/local.xml XML file containing all rates there are
/check.php - sample containing the necessary code which displays and verifies passwords
/cron.php – file responsible for updating /lib/local.xml, can be run manually as well as using CRON
/result.php – file responsible for passwords reception from our server
/select.php – file to view the list of passwords, log-in and password to which specified in /lib/config.php
/setup.php - creates necessary tables in the database

Please note:

1. One database can be used for number of keys;
2. If our server is down for some reason at the time of XML file update, the file is not updated and the current copy is used. Taking into consideration that the rates are rarely updated, it won't have any affect on the website performance;
3. result.php must return HTTP status 200 OK and the word "OK" in the body of the answer.

Implementation examples:

Check out the source code for the script here.

Code examples for generating payment instructions according to rate scale in XML and JSON formats can be downloaded here.

Rate scale is an important element for work with this sms:key version. The scale is generated according to the settings of your specific service and is always available in XML and JSON formats in addresses such as:

http://key.smscoin.com/xml2/key/key id/

http://key.smscoin.com/json/key/key id/

XML-file also contains information about short codes users send the messages to (number field), and keywords necessary for the processing of messages by our system (prefix field) which must be in the text of the message in order for our system to process it correctly. Within different countries various short codes and sometimes different keywords operate.

To ensure that the message is identified with your service, it must look like this

keyword key ID arbitrary text

and it should be sent to correct short code operating within the country of the sender and according to message cost set by you. If a country does not appear in the above-mentioned rates scale, it means that this specific country does not include the rate you chose during the set up process and thus won't be processed. Messages sent by users across the territory of this country, will be ignored. If a country does not appear in your rates scale, it means that this specific country does not include the rate you chose during the set up process and thus messages sent by users across the territory of this country won't be processed.

The entire list of parameters can be found in Rates scale page.

Share |