Send a text message with PHP in under 2 minutes

Install PHP code in your application

Prerequisites:



Add the Code

Copy the following code to your fill or download PHP code - here

 
<?php 

if ( ! function_exists('send_guni_sms')) {

function send_guni_sms($to, $message, $sender_id="#SharedNum#"){

$url = "https://api.gunisms.com.au/api/v1/gateway";

$token = "etesto";

$curl = curl_init($url);

$header = [
"Authorization: Bearer ".$token,
"Content-Type: application/json",
"Accept: application/json"
];


$post_data = [
'sender' => $sender_id,
'message' => $message,
'contacts' => [$to],
'replyLink' => FALSE
];

$post_data = json_encode($post_data);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

$response = curl_exec($curl);

$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

curl_close($curl);

return $response;
}


}