Skip to content
back2arie edited this page May 17, 2011 · 10 revisions

What is it good for?

Let say that you have some application like Point Of Sale, SAP, ERP, or other application that contains information about your client or friends, and somehow you want to reach them via SMS. OK, you have install Kalkun and it’s runs well, but how you send SMS with contact from other application? add/import it to Kalkun phonebook? Hmmm, it’s OK if you have only a few contact, but how about hundred or thousand contact? Your data will become redundant and hard to maintain.

So, maybe a better way is using "independent protocol" that allow applications communicate each other, known as web service, we’ve planning using REST to implement it. But it’s under (very slow) development and we need some more time to finish it.

But, right now, we’ve implemented (actually, experimental one) a way for your application to communicate to Kalkun through PHP cURL. Let’s see how to use it.

How to use it?

It is pretty easy, you just need to include Kalkun_API.php file (located on scripts/cURL/) and send some parameters and done.

include_once("Kalkun_API.php");

// some logic here, eg: database query to get phone number, and looping it
// ...

$config['base_url'] = "http://localhost/kalkun/index.php/"; // Kalkun URL
$config['session_file'] = "/tmp/cookies.txt"; // session file, must be writeable
$config['username'] = "username"; // Username on Kalkun
$config['password'] = "password";
$config['phone_number'] = "123456"; // Your client/friend phone number
$config['message'] = "Test message from API"; // SMS content

$sms = new Kalkun_API($config);
$sms->run();

// Other job
// ...

As you can see, all you need is to change the config parameters based on your configuration.

base_url: your Kalkun URL, don’t forget the index.php/
session_file: a file that save your session a.k.a login credential, it must be writeable by web server user
username and password: your login credential for Kalkun, not your application
phone_number: destination phone number, you’ve to get it from your application (through database query)
message: the SMS content

That's it!

Note: This only works on PHP script, of course you can use it (with some modification) with other language that support cURL or standard POST method.

Clone this wiki locally