<!-- Intent: send the voice message with voicecode of 100000 to an array of contacts posted in the body of the request and name the alert "My Test Alert" --> <?php $url = 'http://api.v4.swiftreach.com/api/Messages/Voice/Send/MY%20Test%20Alert/100000'; $authToken = '123456'; $jsonString = ' [{ "EntityName":"Sample Test", "EntityGuid":"952a9bb6-ceac-4f15-9678-ec4e52f564a1", "Phones":[{ "Phone":"9085551212", "Extension":"", "AnsDetectionOverride":0, "OptInSMS":true, "PhoneType":0, "PhoneLabel":"Mobile" },{ "Phone":"7025551212", "Extension":"", "AnsDetectionOverride":0, "OptInSMS":true, "PhoneType":0, "PhoneLabel":"Phone" }] }]'; $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); ?>