As requested, sample code for the api is now available, download them now, It is available for the following languages at the moment.
If it still does not fulfill your needs, Check out how to use it as HTTP Request.
https://blog.experttexting.com/using-experttexting-as-http-request/
Happy Texting !!
Many of our customers have been asking for integration with PHP. Here is sample code and class files for your easy integration .
To start with lets write a base class with basic functionality which performs the following tasks.
Please make sure to replace the variables in bold with your experttexting account details and the sms details before using this example.
<?php
class experttexting_sms{
public $base_url_SendSMS= ‘https://www.experttexting.com/exptapi/exptsms.asmx/SendSMS’;
public $base_url_SendSMSUnicode= ‘https://www.experttexting.com/exptapi/exptsms.asmx/SendSMSUnicode’;
public $base_url_QueryBalance=’https://www.experttexting.com/exptapi/exptsms.asmx/QueryBalance’;
public $username= ‘Your UserName Here’;
public $password= ‘Your Password Here’;
public $apikey= ‘Your API Key Here’;
public $msgtext= ”;
public $from= ”;
public $to= ”;
function send(){
$fieldcnt=6;
$fieldstring = “Userid=$this->username&pwd=$this->password&APIKEY=$this->apikey&MSG=$this->msgtext&FROM=$this->from&To=$this->to”;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$this->base_url_SendSMS);
curl_setopt($ch,CURLOPT_POST,$fieldcnt);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fieldstring);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
function sendUnicode(){
$fieldcnt=6;
$fieldstring = “Userid=$this->username&pwd=$this->password&APIKEY=$this->apikey&MSG=$this->msgtext&FROM=$this->from&To=$this->to”;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$this->base_url_SendSMSUnicode);
curl_setopt($ch,CURLOPT_POST,$fieldcnt);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fieldstring);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
function QueryBalance(){
$fieldcnt=3;
$fieldstring = “Userid=$this->username&pwd=$this->password&APIKEY=$this->apikey”;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$this->base_url_QueryBalance);
curl_setopt($ch,CURLOPT_POST,$fieldcnt);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fieldstring);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
}
?>
Sending SMS
<?php
require_once(‘expt.php’); // Include SMS base class file. download from the URL above
$expertTexting= new experttexting_sms(); // Create SMS object.
$expertTexting->from= ‘SENDERID’; // Sender of the SMS – PreRegistered through the Customer Area.
$expertTexting->to= ‘Receiver Number’; // The full International mobile number of the without + or 00
$expertTexting->msgtext= ‘SMS text’; // The SMS content.
//echo $expertTexting->send(); // Send SMS method.
echo $expertTexting->sendUnicode(); // Send Multilangual SMS method.
//echo $expertTexting->QueryBalance(); // Query Your Account Balance method.
?>