<!-- Intent: sends a voice message with voicecode 100123 and 
		sends an email message with emailcode 100278 to 
		an array of contacts and names the alert "My Test Alert"
	-->


<?php
$url = 'http://api.v4.swiftreach.com/api/Alerts/Send/MY%20Test%20Alert/100123/0/0/100278/0';
$authToken = '123456';

$jsonString = ' 
[{ 
	"EntityName":"Sample Test", 
	"EntityGuid":"952a9bb6-ceac-4f15-9678-ec4e52f564a1", 
	"Phones": 
		[{ 
		"Phone":"5551234568", 
		"Extension":"", 
		"AnsDetectionOverride":0, 
		"OptInSMS":true, 
		"PhoneType":0, 
		"PhoneLabel":"Mobile" 
		},{ 
		"Phone":"5551234569", 
		"Extension":"", 
		"AnsDetectionOverride":0, 
		"OptInSMS":false, 
		"PhoneType":0, 
		"PhoneLabel":"Phone" 
		}],
	"Addresses": 
		[{ 
		"AddressGuid":"9a360c7a-dd65-4fcf-96fe-ff20a63610b0", 
		"Label":"Primary Address", 
		"Address1":"", 
		"Address2":"", 
		"City":"", 
		"State":"", 
		"PostalCode":"", 
		"County":"", 
		"Latitude":0.0, 
		"Longitude":0.0, 
		"IsPrimary":true 
		}], 
		"Email":"testing@swiftreach.com", 
		"Fax":"5555551212", 
		"SMSPhone":"", 
		"SMSNetwork":0, 
		"Pager":"", 
		"PagerNetwork":0, 
		"PinCode":"", 
		"SpokenLanguage":"English", 
		"Tag":"", 
		"UserDefined":[] 
}]';

$headers = array(
    'Content-type: application/json',
    'SwiftAPI-Key: ' . $authToken,
    'Accept: application/json',
    'Expect:'
);
$ch = curl_init();
$args = array(
    CURLOPT_URL => $url,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => $jsonString,
    CURLOPT_HTTPHEADER => $headers,
);
curl_setopt_array($ch, $args);
$res = curl_exec($ch);
$res_data = json_decode($res, true);
print($res_data);
?>