<!-- Intent: Generate an audio file recording using text-to-speech for VoiceCode 100000 with an audio file fragment code of 200123 using a language of English --> <?php $url = 'http://api.v4.swiftreach.com/api/Messages/Voice/GenerateAudio/100000/200123/English'; $authToken = '123456'; $jsonString = "This is my message in English."; $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); ?>