
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 the passwords. Given the popularity of sms:key services among our clients, we've created more flexible version of the above for those of you who have a 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.
Implementation details
Message handler (Result URL) excepts 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 your 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 set up
SQLite - equires SQLite module set up
PDO:SQLite (object-oriented version) – requires PDO and SQlite modules set up (usually set on PHP >= 5.1)
Installation process:
1. unpack 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 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 the 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 — an important element when working with this sms:key version. Scale is generated according to the settings of your specific service and 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 above 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 contained in the text of the message in order for our system to process it correctly. Within different countries various short codes are operating, and sometimes different keywords.
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 sms-message cost set by you. If a country does not appear in the rate scale mentioned earlier, 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 service rate 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 Rate scale page.