How to integrate sms api in codeigniter using Spring Edge sms gateway

integrate sms api in codeigniter

Below is a detailed walk through Integration of SMS gateway notifications API to php Codeigniter.

Codeigniter is a lightweight MVC based framework to develop web-based applications. Codeigniter is an open-source framework built in PHP language. Using codeigniter Developers can easily build large web software or a small website. Codeigniter has a good community and documentation, Its simple yet powerful framework which help developers to minimize code and maintain coding standard to build robust dynamic web-based applications.

Codeigniter libraries, plugins and helpers make easier to write and maintain source code. It is easy to add new functionality like integrating sms is easy to add using codeigniter helpers.

This article is about how to integrate sms gateway functionality with php codeigniter using spring edge sms gateway APIs.


  • knowledge of PHP and Codeigniter.
  • Account/API key with Spring Edge SMS Gateway.
  • SMS Sender Name provided by Spring Edge.
  • A Working environment to run codeigniter.

Lets get started:

Sign Up With Spring Edge SMS Gateway:

Fill an online form with your name, email and other details on website to sign up. Upon sign up for sms account, you will get trail credits in account to get started with. You can use these sms credits by sending sms using spring edge web app or sms API.

Generating API Auth Key:

Auth Key is used to secure access of our sms account and prevent unauthorised access. Auth key is mandatory to send sms using RestAPIs. You can generate auth key using “Developers” menu of sms application. For security purpose Auth keys are communicated to registered email address only.

Generating API Auth Key

Send a test message:

You can send test sms by two ways, user-interface and RestAPI. You can login into your sms account and send sms using Compose Message menu. You can check sent sms report for acknowledgement of recently sent messages.

Now, Integrate with codeigniter

To start with codeigniter sms gateway integration, we will create a helper in codeigniter helpers folder. Helper functions can be called from any controller in codeigniter.

Create a new file application/helpers/sendsms_helper.php with below content:

function sendsms($mobileno, $message){

    $message = urlencode($message);
    $sender = 'SEDEMO'; 
    $apikey = 'API_KEY_HERE';
    $baseurl = ''.$apikey;

    $url = $baseurl.'&sender='.$sender.'&to='.$mobileno.'&message='.$message;    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);

    // Use file get contents when CURL is not installed on server.
        $response = file_get_contents($url);

In helper function we have used CURL to call sms api. It is recommanded to make sure CURL is installed on server. We have also used file get contents function as an alternative.

Load sms helper in controller:

To send sms from codeigniter controller, we have to load helper first. We can use below code to load send sms helper. This code can be placed in constructor.


Call sendsms function:

After helper loaded, its function will be available directly. You can just use below code to call send text message to given mobile number.

sendsms( '919918xxxxxx', 'Hi, this is a test message' );

This code will call the helper function which will trigger sms api and deliver sms to mobile number.

Deployment on production:

To configure it in a production environment of your codeigniter application, You need to move from existing Test/Trail sms gateway account to a commercial. Once commercial account is set-up, You will need to configure auth key and customized sender name in helper.


To integrate sms gateway functionality with codeigniter, we have created a helper function which take mobile number and text message body as input. We have used RestAPI from spring edge sms gateway to send sms.


5 Tips to Online Security Secrets You Never Knew

5 Tips to Online Security Secrets

Hello Everyone,

Having trouble to browse the internet like before? Haven’t you thought any solution to get rid of this problem yet? If no…Then you are not alone.Thousands of people are suffering the security problem on the internet. That’s why they are losing the valuable properties that they can never imagine.

It is first and foremost duty for the online user to know more about the security. You should keep in mind that thousands of dishonest people are trying their level best for hampering the web. For Securing Your Home and furniture Urban Ladder website for an authentic resource for your home furniture safety But For Online Security You Must Read All Given Points.

It is not so important to know that at what steps of online you are in.But the thing you must know that the secret tips of the online security.That will help you enjoy the web more than before. Let’s broke the secret tips for you.

5 Tips to Online Security Secrets

1. The complex password is must:

The most popular password in 2016 was the same as in 2015 and 2014: 123456. Second and third area strengthen 123456789 and qwerty, respectively. Considering the circumstances, it’s not irregular that so many security breaches happen.

As an act in mitigation, a recent psychiatry from the cyber-security authentic Preempt revealed that 35% of LinkedIn users have used pale passwords, appropriately increasing the chances of their accounts getting hacked.

That’s why you must obey some criteria for making a better password for your next account. Like

  • Use at least 12 characters.
  • Must include numbers, symbols and so more.
  • Don’t use a dictionary word.
  • Use a combination of words.

2. Use 2-step verification system:

The two-step verifications system would be an additional feature but it is just yet.It bears a extra security or safety for your account.This system requires when anyone tries to log in to your account from an unauthorized device.It helps to prevent hacking also.

3. Keep your device update:

Don’t forget to activate the automatic update option for your device update.That’s why all of the software gets updated when it is available.You will stay more secure from the heuristic web than before.

4. Install strong antivirus software:

There are no soldiers on the web for fighting against the web devil like the antivirus.There are many strong antiviruses.Like, the Avast, the Norton and many more.You can use that prefers you most. However, always keep in eye on upgrade version that helps for making a strong firewall for your device.

5. Expand your network security:

Have you given any attention to the fact that yet? It is safety for you to browse the web when you are in the home.Because you are using a password protected network.But when you are on the way of your office you are using the cellular data.That’s it’s not so hard for the hacker to know any information about your device.To get rid of these problems you must use a VPN.That can give you a permanent security on the web.


You are not the owner of the web.That’s why it is simple to face problem at the time of browsing the web.It is not mean that you won’t use web anymore. Rather you should learn more about the security of the web.Ultimately, you should implement all the tactics stated above that can make your web journey more interesting.