Send SMS with PHP SMS Script

PHP SMS messaging is one of the services we offer. Here we'll show you how to use our SMS gateway in PHP. Take the SMS PHP script code below to send SMS via Developers’ Central. Simply register for an account, and you will automatically receive 20 FREE SMS credits to try our service.  


$admsms='Hello %name%. You are admitted in %class% for session %session%.';

$sms=str_ireplace(array('%name%','%class%','%session%'),array('Indrajit Lahiri','Nursery','2015-16'),$admsms);
$sms=str_replace(' ','%20',$sms);
// to replace the space in message with  '%20'

// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL,$url);
// grab URL and pass it to the browser
// close cURL resource, and free up system resources


Account Parameters
APIKey Instead of the username and password you can use the API KEY for authentication of account.
Message Parameters
senderid Approved sender id(6 characters string only).
channel Message channel Promotional=1 or Transactional=2
route Pass the route id in this parameter to route the message. Click Here for more information regarding your routeid.
DCS Data coding value (Default is 0 for normal message, Set 8 for unicode sms)
flashsms Flash message immediate display (Default is 0 for normal sms, Set 1 for immediate display)
number Recipient mobile number (pass with comma seprated if need to send on more then one number)
text Your sms content
Optional Parameters
schedtime Schedule date and time for scheduling message (DateTime formate will be 2014/10/06 20:30:00 PM yyyy/mm/dd hh:mm:ss PM)
groupid group id for numbers

Please note that some of the above code has been supplied to SMSGATEWAYHUB by clients. As such, accuracy is not guaranteed by SMSGATEWAYHUB.