Skip to content

Commit b9fd418

Browse files
committed
init
0 parents  commit b9fd418

File tree

7 files changed

+114
-0
lines changed

7 files changed

+114
-0
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/opensourcepos.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
![](https://www.sms77.io/wp-content/uploads/2019/07/sms77-Logo-400x79.png "sms77 Logo")
2+
3+
# sms77 SMS for Open Source Point of Sale
4+
5+
This code implements sms77 as SMS gateway for sending messages via OSPOS.
6+
7+
## Prerequisites
8+
9+
- An API Key from [sms77](https://www.sms77.io) - you can create on in
10+
your [developer dashboard](https://app.sms77.io/developer).
11+
- An existing [OSPOS](https://opensourcepos.org/) installation.
12+
13+
## Installation
14+
15+
The procedure for installing is very simple. You just need access to the installation path
16+
of OSPOS for replacing `/application/libraries/Sms_lib.php`
17+
with [Sms_lib.php](Sms_lib.php).
18+
19+
## Setup
20+
21+
1. Log in to your OSPOS dashboard.
22+
2. Go to `Configuration -> Setup & Conf -> Message`.
23+
3. Set `SMS-API Username` to any value, as the field is not used. Just make sure it's not
24+
empty.
25+
4. Set `SMS-API Password` to your sms77 API key.
26+
5. Set `SMS-API Sender ID` to your sender identifier of choice with a maximum length of 11
27+
alphanumeric or 16 numeric characters. This value gets displayed as the sender in the
28+
receivers phone device. Please notice that country specific restrictions may apply,
29+
e.g. some countries don't allow setting those at all.
30+
6. Optionally set `Saved Text Message` to a predefined message template.
31+
7. The last step is to save your configuration by clicking `Submit`.
32+
33+
See the [screenshot](configuration.png) for an example configuration.
34+
35+
## Support
36+
37+
Feel free to [contact us](https://www.sms77.io/en/company/contact/) in case you need any
38+
assistance.

Sms_lib.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2+
3+
/**
4+
* SMS library
5+
* Library with utilities to send texts via SMS Gateway (requires proxy implementation)
6+
*/
7+
class Sms_lib {
8+
private $CI;
9+
10+
public function __construct() {
11+
$this->CI =& get_instance();
12+
}
13+
14+
/*
15+
* SMS sending function
16+
* Example of use: $response = sendSMS('4477777777', 'My test message');
17+
*/
18+
public function sendSMS($to, $text) {
19+
$password = $this->CI->encryption->decrypt($this->CI->config->item('msg_pwd'));
20+
$from = $this->CI->config->item('msg_src');
21+
$response = false;
22+
23+
if (!empty($password) && !empty($phone) && !empty($text) && !empty($from)) {
24+
$ch = curl_init('https://gateway.sms77.io/api/sms');
25+
$options = [
26+
CURLOPT_HTTPHEADER => [
27+
'Accept: application/json',
28+
'Content-Type: application/json',
29+
'X-Api-Key: ' . $password,
30+
],
31+
CURLOPT_POSTFIELDS => json_encode(compact('from', 'text', 'to')),
32+
CURLOPT_RETURNTRANSFER => true,
33+
];
34+
curl_setopt_array($ch, $options);
35+
$response = curl_exec($ch);
36+
curl_close($ch);
37+
}
38+
39+
return $response;
40+
}
41+
}
42+
43+
?>

configuration.png

82.7 KB
Loading

0 commit comments

Comments
 (0)