<?php
DEFINE ('SMATACO_KEY','47ef36b34a570e4fd8543916905cbaecf5b3fde2e77270da');


function SendWhatsapp($number,$message) {
	$curl = curl_init();
	curl_setopt_array($curl, array(
	   CURLOPT_URL => 'https://api.omnichannelmessenger.com/api/sendText',
	   CURLOPT_RETURNTRANSFER => true,
	   CURLOPT_ENCODING => '',
	   CURLOPT_MAXREDIRS => 10,
	   CURLOPT_TIMEOUT => 0,
	   CURLOPT_FOLLOWLOCATION => true,
	   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	   CURLOPT_CUSTOMREQUEST => 'POST',
	   CURLOPT_POSTFIELDS =>'{
		"number": "'.$number.'",
		"key": "'.SMATACO_KEY.'",
		"message": "'.$message.'"
		}',
	   CURLOPT_HTTPHEADER => array(
		  'Content-Type: application/json'
	   ),
	));
	$response = curl_exec($curl);
	curl_close($curl);
	echo $response;
}

function SendImagesUrl($number,$caption,$url) {
	$curl = curl_init();
	curl_setopt_array($curl, array(
	   CURLOPT_URL => 'https://api.omnichannelmessenger.com/api/sendImage',
	   CURLOPT_RETURNTRANSFER => true,
	   CURLOPT_ENCODING => '',
	   CURLOPT_MAXREDIRS => 10,
	   CURLOPT_TIMEOUT => 0,
	   CURLOPT_FOLLOWLOCATION => true,
	   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	   CURLOPT_CUSTOMREQUEST => 'POST',
	   CURLOPT_POSTFIELDS =>'{
		"number": "'.$number.'",
		"key": "'.SMATACO_KEY.'",
		"caption": "'.$caption.'",
		"url": "https://www.sample-videos.com/img/Sample-jpg-image-100kb.jpg"
	}',
	   CURLOPT_HTTPHEADER => array(
		  'Content-Type: application/json'
	   ),
	));
	$response = curl_exec($curl);
	curl_close($curl);
	echo $response;
}

function SendDocuments($number,$caption,$url) {
	$curl = curl_init();
	curl_setopt_array($curl, array(
	   CURLOPT_URL => 'https://api.omnichannelmessenger.com/api/sendDocument',
	   CURLOPT_RETURNTRANSFER => true,
	   CURLOPT_ENCODING => '',
	   CURLOPT_MAXREDIRS => 10,
	   CURLOPT_TIMEOUT => 0,
	   CURLOPT_FOLLOWLOCATION => true,
	   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	   CURLOPT_CUSTOMREQUEST => 'POST',
	   CURLOPT_POSTFIELDS =>'{
		"number": "'.$number.'",
		"key": "'.SMATACO_KEY.'",
		"caption": "'.$caption.'",
		"url": "'.$url.'"
	}',
	   CURLOPT_HTTPHEADER => array(
		  'Content-Type: application/json'
	   ),
	));
	$response = curl_exec($curl);
	curl_close($curl);
	echo $response;
}

?>