Example api code for Transactional SMS in php

Replace user, password, msisdn, sid and message accordingly.

 

1. Below is the sample code for php for Single Message:

<?php
$user = 'abc';
$password = 'xyz';
$msisdn = '919898xxxxxx';
$sid = 'SenderId';
$message = 'test message';
$fl = '0';
$gwid = '2';

$url = 'http://sms.domainadda.com/vendorsms/pushsms.aspx?user=' . $user . '&password=' . $password . '&msisdn=' . $msisdn . '&sid=' . $sid . '&msg=' . urlencode($message) . '&fl=' . $fl . '&gwid=' . $gwid;

$response = file_get_contents($url);

if ($response === false) {
echo 'Error sending request';
} else {
echo 'API response: ' . $response;
}
?>

 

2. Below is the sample code for php for Multiple Messages:

<?php
$user = 'abc';
$password = 'xyz';
$msisdns = '919898xxxxxx,919898xxxxxx'; // Comma-separated list of phone numbers
$sid = 'SenderId';
$message = 'test message';
$fl = '0';
$gwid = '2';

$url = 'http://sms.domainadda.com/vendorsms/pushsms.aspx?user=' . $user . '&password=' . $password . '&msisdn=' . urlencode($msisdns) . '&sid=' . $sid . '&msg=' . urlencode($message) . '&fl=' . $fl . '&gwid=' . $gwid;

$response = file_get_contents($url);

if ($response === false) {
echo 'Error sending request';
} else {
echo 'API response: ' . $response;
}
?>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Example api code for Transactional SMS in asp.net

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Transactional SMS in ruby

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Transactional SMS in java

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Transactional SMS in node.js

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Transactional SMS in python

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...