Setting up a Custom SMS Gateway

In version 1.08 or later, ServerPing supports using any SMS gateway through a custom php class.


-SSH to each check worker server and create the following directory:
/home/serverping/serverping/custom_classes/sms

In this new directory create a php file called custom.php with the following contents:

<?php


class CustomSMSGateway {

  function sendSms($to, $from, $username, $password, $message, $url) {
     $ch = curl_init();
     $message = urlencode($message);
     curl_setopt($ch, CURLOPT_URL, $url . "?username=" . $username . "&password=". $password . "&from=" . $from . "&to=" . $to. "&text=".$message);
     curl_setopt( $ch , CURLOPT_SSL_VERIFYHOST , false );
     curl_setopt($ch , CURLOPT_SSL_VERIFYPEER , false );
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $data = curl_exec($ch);
     curl_close($ch);   
   }
  
}
 
?>


You can then change the sendSms function to work with the third party SMS gateway of your choosing.

Make sure you create this directory and place your customized custom.php file on each check worker server and after putting this file in place run
supervisorctl reload 

Which will reload the php processes and load your custom gateway class.

To activate the custom sms gateway: 
Login to the WHMCS admin area and go to Addons->ServerPing.
Remove any existing SMS settings and fill in the Custom SMS Gateway URL, from number, username, and password which will be passed to your custom gateway function and click save.

ServerPing will now see that you have entered a custom gateway information and will use this function to send sms messages.
  • 82 Los Usuarios han Encontrado Esto Útil
¿Fue útil la respuesta?

Artículos Relacionados

Installation Guide

Requirements You will need at least one Cent OS 6 (64 bit recommended) VPS/Dedicated server with...

Adding ServerPing Package

  Login to your WHMCS Admin Area and go to Setup->Products/Services->Products/Services...

Adding a SMS Credits Package

Login to your WHMCS Admin Area and go to Setup->Products/Services->Products/Services...

Adding ServerPing to your Client Area template

You will need to provide a link to the SeverPing module from your client area. We recommend...

System Requirements

Requirements You will need at least one Cent OS 6 (64 bit recommended) VPS/Dedicated server with...