Git Product home page Git Product logo

sms-php-api's Introduction

#Ideamart sms PHP API


This is the ideamart SMS PHP API, using the classes here you can recieve messages, send messages to a address, list of addressses or a broadcast message and log using the log class.

###Creating a Listener to recieve messages

require 'SMSReceiver.php';  // Import the SMSReceiver Class

// Create a object of the SMSReceiver and send the incomming request to be decoded

$receiver = new SMSReceiver(file_get_contents('php://input'));

$receiver->getMessage()     // Get the messsage recieved 
$receiver->getAddress()     // Get the address from which message was sent
$receiver->getVersion()     // Get the version of the incomming request
$receiver->getEncoding()        // Get the encoding of the incomming request
$receiver->getApplicationId()   // Get the appid which the request was sent to
$receiver->getRequestId()       //  Get the uniqe requestID of the request

Creating a sender to Send SMSs


In simulation you can use any appid and password. In production a appid and password will be provided when the app is be provisioned in Ideamart.

Production Server URLs

HTTP - http://api.dialog.lk:8080/sms/send

HTTPS - https://api.dialog.lk/sms/send

Simulator Server URL HTTP -http://localhost:7000/sms/send


require 'SMSSender.php';  // Import the SMSSender Class

define('SERVER_URL', 'http://localhost:7000/sms/send'); // Set the Server URL
define('APP_ID', 'appid');							  // Set the APPID
define('APP_PASSWORD', 'pass');						 // Set the password

// Create Sender intialze the object with the SeverURL , APPID and APP Password
$sender = new SMSSender( SERVER_URL, APP_ID,  APP_PASSWORD); 

To send a SMS to a user

$sender->sms( 'This message is send to one particlar no', ADDRESS)

To send a SMS to number of users

$sender->sms( 'Same message to all the address send', array(ADDRESS1, ADDRESS2, ...))

To broadcast a SMS to all the subcribers of the app

$sender->broadcast( 'This is a Broadcast Message')

sms-php-api's People

Contributors

pasindud avatar

Watchers

James Cloos avatar Darshana Wijesekara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.