0% found this document useful (0 votes)
324 views

Codeigniter Sms API Library To Send

This document provides instructions for using a Codeigniter library to send SMS messages. It includes downloading a sendsms_helper.php file, loading the SMS helper, and calling the sendsms function to send messages by passing in the phone number, message, and return value. The sendsms function uses CURL to send requests to an SMS gateway API to deliver the messages.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
324 views

Codeigniter Sms API Library To Send

This document provides instructions for using a Codeigniter library to send SMS messages. It includes downloading a sendsms_helper.php file, loading the SMS helper, and calling the sendsms function to send messages by passing in the phone number, message, and return value. The sendsms function uses CURL to send requests to an SMS gateway API to deliver the messages.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Table

of Contents
Introduction 1.1
First Chapter 1.2

1
Introduction

Codeigniter-sms-api : Codeigniter Library


to send sms

Codeigniter send sms


Start sendsms_helper.php file sendsms_helper.php Save below code as sendsms_helper.php in
/application/helpers/ Author: Spring Edge ( http://www.springedge.com )

function sendsms($number, $message_body, $return = '0') {

$sender = 'SEDEMO'; // Need to change

$smsGatewayUrl = 'http://springedge.com';

$apikey = '62q3z3hs4941mve32s9kf10fa5074n7'; // Need to change

$textmessage = urlencode($textmessage);

$api_element = '/api/web/send/';

$api_params = $api_element.'?
apikey='.$apikey.'&sender='.$sender.'&to='.$mobileno.'&message='.$textmessage;
$smsgatewaydata = $smsGatewayUrl.$api_params;

$url = $smsgatewaydata;

$ch = curl_init();

curl_setopt($ch, CURLOPT_POST, false);

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch);

curl_close($ch);

if(!$output){ $output = file_get_contents($smsgatewaydata); }

if($return == '1'){ return $output; }else{ echo "Sent"; }

End sendsms_helper.php file

2
Introduction

How to Use:
Load sendsms helper as $this->load->helper('sendsms_helper');

Call sendsms function Ex. sendsms( '919918xxxxxx', 'test message' );

3
First Chapter

First Chapter
GitBook allows you to organize your book into chapters, each chapter is stored in a separate
file like this one.

You might also like