How to use ‘smsgupshup’ SMS Service In php project?

[caption id="attachment_1572" align="aligncenter" width="300"]smsgupshup SMS Service In php smsgupshup SMS Service In php[/caption] Smsgupshup of SMS service enables your messages to reach both smartphones and feature phones on any network worldwide. I added one function to send the sms using 'smsgupshup' service. To send sms, you have to get the register and get the api user id, api user password. I used this function in yii framework and php project.

<?php
public static function send($data,$mobile,$template){
$mobile=trim($mobile);
$curl_scraped_page='';
$employee_name=$data['emp_name'];
$visitor_name=$data['visitor_name'];
$company_name=$data['company_name'];
$employee_name=urlencode($employee_name);
$visitor_name=urlencode($visitor_name);
$company_name=urlencode($company_name);

$url="http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to=".$mobile;
// add the message
$url.="&msg=Hi%20".$employee_name."%2C%20".$visitor_name."%20from%20".$company_name."%20has%20come%20to%20meet%20you";
// Add the message type, api user id, api password, and message mask word
$url.="&msg_type=TEXT&userid=".$API_USER_ID."&auth_scheme=plain&password=".$API_USER_PASSWORD."&v=1.1&format=text&mask=".$MESSAGE_MASK;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);

//$curl_scraped_page="success | 91123456789 | 22***************-29***************";
return $curl_scraped_page;
}
  • Gaurav Kumar

    Hi ,
    I want response as a json please help……