Web Apps

WordPress SMS Safaricom Gateway for BulkSMS/SMS Subscription

Do you want to send posts to your subscribers through SMS? WordPress SMS is the best plugin. You can add to wordpress, the ability of sending sms, member of sms newsletter and send to them sms. To every change of position in wordpress, you can send an sms through this plugin. The usage of this plugin is completely free.
However this plugin cannot be used in Kenya if you are not a client of Africastalking . I have cracked this challenge while i was designing my news website Siasa News Kenya. What you simply need to do is;

  1. download and install WordPress SMS
  2. Open your Cpanel and locate the file 0098sms.class.php which is in wp-content/plugins/wp-sms/includes/gateways
  3. Open the file 0098sms.class.php
  4. Copy the codes below and replace it with 0098sms.class.php content.
  5. in  proxy( ‘00.00.00.00’ ,80,”/sms/sender.php?usr=USERNAME&pass=PASWORD&src=SRC&dest=” . $number . “&msg={$msg}”); change the IP, USERNAME, PASWORD,SRC and sender.php name to your custom names
  6. Done!!! you can now send SMS

GATEWAY CODE

<?php
ini_set('allow_url_fopen',1);
error_reporting(E_ALL);
ini_set('display_errors', 1);
class _0098sms extends WP_SMS
{
 private $wsdl_link = "http://www.0098sms.com/";
 public $tariff = "http://www.0098sms.com/";
 public $unitrial = false;
 public $unit;
 public $flash = "enable";
 public $isflash = false;

 public function __construct()
 {
 parent::__construct();
 $this->validateNumber = "09xxxxxxxxx";
 }

 public function SendSMS()
 {
 // Check gateway credit
 if (is_wp_error($this->GetCredit())) {
 return new WP_Error('account-credit', __('Your account does not credit for sending sms.', 'wp-sms'));
 }

 /**
 * Modify sender number
 *
 * @since 3.4
 * @param string $this ->from sender number.
 */
 $this->from = apply_filters('wp_sms_from', $this->from);

 /**
 * Modify Receiver number
 *
 * @since 3.4
 * @param array $this ->to receiver number
 */
 $this->to = apply_filters('wp_sms_to', $this->to);

 /**
 * Modify text message
 *
 * @since 3.4
 * @param string $this ->msg text message.
 */
 $this->msg = apply_filters('wp_sms_msg', $this->msg);
$phone = $this->to;
 $msg = urlencode($this->msg);
function proxy($host,$port,$url){
 $errno = "";
 $errstr = "";
 $fp = fsockopen($host, $port, $errno, $errstr, 30);

 if (!$fp)
 return "Error: Server is Temporarily unavailable. Try again later.n";

 fwrite ($fp, ("GET ". $url . " HTTP/rnrn"));

 $s = "";
 while (!feof($fp))
 $s .= fgets($fp, 128);

 fclose($fp);

 $a = strpos ($s,"rnrn");
 return substr ($s,($a+4));
}
 foreach ($this->to as $number) {
 
proxy( '00.00.00.00' ,80,"/sms/sender.php?usr=username&pass=passwprd&src=SRC&dest=" . $number . "&msg={$msg}");
 $result = "1";
 
 }

 if ($result->Code == 0) {
 $this->InsertToDB($this->from, $this->msg, $this->to);

 /**
 * Run hook after send sms.
 *
 * @since 2.4
 * @param string $result result output.
 */
 do_action('wp_sms_send', $result);

 return $result;
 }

 return new WP_Error('send-sms', $result);
 }

 public function GetCredit()
 {
 // Check username and password
 if (!$this->username && !$this->password) {
 return new WP_Error('account-credit', __('Username/Password does not set for this gateway', 'wp-sms'));
 }

 return true;
 }
}
Laravel vs CodeIgniter Which is the best?
Error: Key of size 5 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported.

Advertise with us

We can connect you to one of the world’s largest audiences of high net worth, highly educated & international professionals.

My Portfolio

I have been involved in the delevelopment or various applications and websites