DEVELOPER ZONE - SMS

Send SMS Via API

Check Credit Balance Via API

Get Delivery Report Via API

Icon-Developer dev 200x200

Sending SMS API

http://smsportal.pigeonhost.com/api?api_key=(API Key)&act=balance

<?php
$post_url = ‘http://smsportal.pigeonhost.com/smsapi’ ;

$post_values = array(
‘api_key’ => ‘API KEY’,
‘type’ => ‘text’, // unicode or text
‘senderid’ => ‘SENDER ID’,
‘contacts’ => ‘MOBILE NUMBER’,
‘msg’ => ‘Hello world’,
‘method’ => ‘api’
);

$post_string = “”;
foreach( $post_values as $key => $value )
{ $post_string .= “$key=” . urlencode( $value ) . “&”; }
$post_string = rtrim( $post_string, “& ” );

$request = curl_init($post_url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$post_response = curl_exec($request);
curl_close ($request);

$responses=array();
$array = json_decode( preg_replace(‘/[\x00-\x1F\x80-\xFF]/’, ”, $post_response), true );

if($array){
echo $array[‘status’] ;

echo $array[‘CamID’] ;

print_r($array);
}

?>

<?php
$xml = ‘<soapenv:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/”>
<soapenv:Header/>
<soapenv:Body>
<sendsms soapenv:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
<apikey xsi:type=”xsd:string”>API_KEY</apikey>
<type xsi:type=”xsd:string”>text</type>
<senderid xsi:type=”xsd:string”>Sender ID</senderid>
<contacts xsi:type=”xsd:string”>0171….</contacts>
<msg xsi:type=”xsd:string”>Demo Message</msg>
<method xsi:type=”xsd:string”>api</method>
</sendsms>
</soapenv:Body>
</soapenv:Envelope>’;

$url = “http://portal.smsinbd.com/soap/service.php?wsdl”;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

$headers = array();
array_push($headers, “Content-Type: text/xml; charset=utf-8”);
array_push($headers, “Accept: text/xml”);
array_push($headers, “Cache-Control: no-cache”);
array_push($headers, “Pragma: no-cache”);
array_push($headers, “SOAPAction:”);

if($xml != NULL) {
curl_setopt($ch, CURLOPT_POSTFIELDS, “$xml”);
array_push($headers, “Content-Length: ” . strlen($xml));
}

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$soap = simplexml_load_string($response);
$soap->registerXPathNamespace(‘ns1’, ‘http://schemas.xmlsoap.org/soap/envelope/’);
$Result = $soap->xpath(‘//ns1:sendsmsResponse’) ;

print_r($Result);

?>
================================================================================
Result:
Array
(
[0] => SimpleXMLElement Object
(
[return] => SimpleXMLElement Object
(
[CamID] => 531809300***8
[status] => SUCCESS
[cost] => 0.4000
)

)

)
=================================================================================

Credit Balance API

http://smsportal.pigeonhost.com/smsapi?api_key=(APIKEY)&type=text&contacts=(NUMBER)&senderid=(Approved Sender ID)&msg=(Message Content)&method=api

<?php
$post_url = ‘http://smsportal.pigeonhost.com/api’ ;

$post_values = array(
‘api_key’ => ‘API KEY’,
‘act’ => ‘balance’,
‘method’ => ‘api’
);

$post_string = “”;
foreach( $post_values as $key => $value )
{ $post_string .= “$key=” . urlencode( $value ) . “&”; }
$post_string = rtrim( $post_string, “& ” );

$request = curl_init($post_url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$post_response = curl_exec($request);

curl_close ($request);

$responses=array();
$array = json_decode( preg_replace(‘/[\x00-\x1F\x80-\xFF]/’, ”, $post_response), true );

if($array){
echo $array[‘balance’];
echo $array[‘type’];
print_r($array);
}

?>

Delivery Report API

http://smsportal.pigeonhost.com/api?api_key=(API Key)&act=sms_report&sms_shoot_id=(SMS Shoot ID)

PARAMETER DESCRIPTION

Parameter Name Meaning/Value Description
api_key API Key Your API Key
senderid Approved Sender ID Exp: 8804445641111/PigeonHost
type text/unicode text for normal SMS/unicode for Bangla SMS
contacts mobile number Exp: 88017XXXXXXXX+88018XXXXXXXX+88019XXXXXXXX...

Frequently Asked Questions (FAQ's)

Where i can find sender id/api key ?

You can find your sender id/api key in web sms panel.

Do you support dynamic sms ?

Yes ! We support dynamic sms.

What is a Sender ID ?

The recipients receive messages with a title (or Header) and content. The title looks like phone no or brand name. This is called as Sender ID.

What is the maximum text length allowed ?

The message length allowed for single message is 160 characters. If the text length exceeds 160 characters then the message consumes 2 or more credits. The character length for 2 messages is 306, for 3 messages is 459, for 4 messages is 612, and for 5 messages is 724.Maximum 8 message length is allowed.