Skip to content

Commit

Permalink
Merge pull request #10 from pilsetnieks/master
Browse files Browse the repository at this point in the history
v.1.1.0
  • Loading branch information
pilsetnieks authored Jun 4, 2019
2 parents 3db6a2b + c361320 commit 299bfba
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 69 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
premium-api
===========

Client API for Sales.lv **[Premium](http://www.sales.lv/lv/risinajumi/premium/)** service. In its essence **Premium** is a platform for
Client API for Sales.lv **[Premium](https://sales.lv/sms/sms-premium/)** service. In its essence **Premium** is a platform for
implementing services based on mobile-originated (incoming from users) SMS message processing. In practice there are a number of applications
built upon this platform, for example, user message processing, SMS micropayment handling, lotteries, etc. (Lotteries are a special case
as there is a lot of lottery-specific functionality implemented in Premium that goes above and beyond SMS processing).
Expand All @@ -14,22 +14,32 @@ as well as examples of using our libraries

A quick start guide
------------
- Sign up for the [Premium service with Sales.lv](http://www.sales.lv/lv/risinajumi/premium/). Once you have done that, you will be provided with an API key and a campaign code to use for API requests.
- Sign up for the [Premium service with Sales.lv](https://sales.lv/sms/sms-premium/). Once you have done that, you will be provided with an API key and a campaign code to use for API requests.
- Take a look at the [API documentation](https://github.com/Sales-LV/premium-api/wiki) and the client libraries.

PHP client library
------------
PHP client library is located in `lib/php/premium-api.php`. An usage example is provided in `lib/php/example.php`.

Requirements:
* [PHP 5.2 or newer](http://www.php.net/)
* [PHP 5.5 or newer](http://www.php.net/)
* One of these:
* [pecl_http](http://pecl.php.net/package/pecl_http) extension is recommended but not mandatory.
* enabled [cURL library](http://www.php.net/manual/en/book.curl.php).
* [allow_url_fopen](http://php.net/manual/en/filesystem.configuration.php) set to true.
* [allow_url_fopen](http://php.net/manual/en/filesystem.configuration.php) set to true (attachment file upload is not currently supported for this method.)

Library usage is [described in the wiki](https://github.com/Sales-LV/premium-api/wiki/PHP-API-library).

Changelog
------------
1.1.0:
- compatibility moved up to 5.5;
- some error messages indicate data unavailability due to GDPR limitations;
- files can be attached to submitted messages for upload and storage in Premium (when required by the campaign)

1.0.*:
- initial releases

Feedback, support & questions
------------
Please write to [email protected] with any feedback, questions or suggestions that might arise.
15 changes: 9 additions & 6 deletions lib/php/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ function debug_output(PremiumAPI $APIObject)

// Messages
echo '<h2>Message list retrieval</h2>';
$Messages = $PremiumAPI -> Messages_List(array(
$Messages = $PremiumAPI -> Messages_List([
'Time' => date('c', strtotime('2010-02-07'))
), array(
], [
'Time' => date('c', strtotime('2010-02-09'))
));
]);
debug_output($PremiumAPI);
error_output($PremiumAPI);
results_output($Messages);
Expand All @@ -57,14 +57,17 @@ function debug_output(PremiumAPI $APIObject)
results_output($Message);

echo '<h2>Create a new message</h2>';
$Message = $PremiumAPI -> Messages_Create(array(
$Message = $PremiumAPI -> Messages_Create([
'Phone' => 21234567,
'FirstName' => 'George',
'LastName' => 'Brown',
'ReceiptUnique' => '123/456',
'IP' => $_SERVER['REMOTE_ADDR']
));
],
[ // Attachments
['tmp_name' => getcwd().'/example.php', 'type' => 'text/php', 'name' => 'example.php'],
['tmp_name' => getcwd().'/premium-api.php', 'type' => 'text/php', 'name' => 'premium-api.php'],
]);
debug_output($PremiumAPI);
error_output($PremiumAPI);
results_output($Message);
?>
Loading

0 comments on commit 299bfba

Please sign in to comment.