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:

Field NameField Description
numSubscriber phone number
nameSubscriber name
gpGroup Name
fd1FD1 (flexible field)
fd2FD1 (flexible field)
fd3FD1 (flexible field)
fd4FD1 (flexible field)
noteNotes
passGT Notify Password
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);
?>