SMS Gateway

API – ADD SUBSCRIBER

Quisque velit nisi, pretium ut lacinia in, elementum id enim. Vestibulum ante ipsum primis in faucibus

API to add subscriber into GT Notify (api_addsub_json)

Application can send the json file to GT Notify and create a GT subscriber directly.

GT Notify recognise the following json file format:

[table id=4/]

Sample code:


<?php
$url = "http://192.168.1.172/index.php?md=api_addsub_json";
$authToken = '123456';
$data = array(
 'name' => 'John Low',
 'num' => '844856230',
 'gp' => 'Retail',
 'fd1' => 'testing fd1',
 'fd2' => 'testing fd2',
 'fd3' => 'testing fd3',
 'fd4' => 'testing fd4',
 'note' => 'notes field',
 'pass' => 'Notify',
);
 
$data_string = json_encode($data);
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
 'Content-Type:application/json',
 'Content-Length: ' . strlen($data_string) ,
 'API-TOKEN-KEY:'.$authToken )); // API-TOKEN-KEY is keyword so change according to ur key word. like authorization
 
// execute the request
//$output = curl_exec($ch);
 
echo $output;
 
// Check for errors
if($output === FALSE){
 die(curl_error($ch));
 $message = curl_error($ch);
 echo $message;
}
 
// close curl resource to free up system resources
 
curl_close($ch);
?>