<?php 
function envio_whatsapp($mensaje){
	$INSTANCE_ID = "3";  // TODO: Replace it with your gateway instance ID here
	$CLIENT_ID = "edocfa@outlook.es";  // TODO: Replace it with your Forever Green client ID here
	$CLIENT_SECRET = "d0d794f5643e4dcda9d96f0c5dc24510";   // TODO: Replace it with your Forever Green client secret here
	$postData = array(
	  'group_admin' => '51951043140',  // TODO: Specify the WhatsApp number of the group creator, including the country code
	  'group_name' => 'Uso del Teamviewer',    // TODO: Specify the name of the group
	  'message' => $mensaje  // TODO: Specify the content of your message
	);
	$headers = array(
	  'Content-Type: application/json',
	  'X-WM-CLIENT-ID: '.$CLIENT_ID,
	  'X-WM-CLIENT-SECRET: '.$CLIENT_SECRET
	);
	$url = 'http://api.whatsmate.net/v2/whatsapp/group/message/' . $INSTANCE_ID;
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));
	$response = curl_exec($ch);
	echo "Response: ".$response;
	curl_close($ch);
}

?>