Android Facil Android Facil - 1 month ago 15
PHP Question

SMSGATEWAY.ME - Send to more than 2 numbers with PHP API?

Somebody help me please, I am not clear as to send several numbers cell phone, I'm new to php

<?php
include "smsGateway.php";
$smsGateway = new SmsGateway('my_email_on_their_website','my_password_for_this_account');
$deviceID = 111111;
$number = '+1234567891'; //a single number
$message = 'Hello World!'; //my message
$result = $smsGateway->sendMessageToNumber($number, $message, $deviceID);
?>


Any help is welcome

Answer

Try this:

<?php
  include "smsGateway.php";
  $smsGateway = new  SmsGateway('my_email_on_their_website','my_password_for_this_account');
  $deviceID = 111111;
  $numbers = ['+1234567891', '+123123123'];
  $message = 'Hello World!'; //my message

  function sendSms() use (&$smsGateway) 
  { 
    return $smsGateway->sendMessageToNumber($number, $message, $deviceID); 
  }

  $results = array_map('sendSms', $numbers);
Comments