Dear Readers,In this i would like to explain how can we send an SMS through our Application using PHP Code.
In Previous article i explained how to send an SMS using Dot Net Code.Now SMS sending is a most viable in most of the day today applications. Inorder to implement those kind of functionalities following code serves your purpose
SMS Sending is an Paid Service We Need to Get The Application Program Interface (API) from the Service Provider.We need to Consume that particular API from our provider.
For List of API's Click Here.
SMS Sending Code in PHP
<?php
$username = 'xxxxx';
$password = 'xxxxx';
$from = 'JETSMS';
$to = '9133926636, 8886254602';
$smsText = "Welcome to JET BULK SMS API";
$URL = "http://sms.jetbulksmsservice.com/index.php/api/bulk-sms";
$postFields = array(
'username' => $username,
'password' => $password,
'from' => $from,
'to' => $to,
'message' => $smsText,
'sms_type' => 2
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$URL);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
?>
SMS Type is 2 for Transactional SMS
In Previous article i explained how to send an SMS using Dot Net Code.Now SMS sending is a most viable in most of the day today applications. Inorder to implement those kind of functionalities following code serves your purpose
SMS Sending is an Paid Service We Need to Get The Application Program Interface (API) from the Service Provider.We need to Consume that particular API from our provider.
For List of API's Click Here.
SMS Sending Code in PHP
<?php
$username = 'xxxxx';
$password = 'xxxxx';
$from = 'JETSMS';
$to = '9133926636, 8886254602';
$smsText = "Welcome to JET BULK SMS API";
$URL = "http://sms.jetbulksmsservice.com/index.php/api/bulk-sms";
$postFields = array(
'username' => $username,
'password' => $password,
'from' => $from,
'to' => $to,
'message' => $smsText,
'sms_type' => 2
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$URL);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
?>
SMS Type is 2 for Transactional SMS
No comments :
Post a Comment