Sending transcriptions to an outside PHP file

eop -

When using Transcription with an HTTP POST as the delivery method, Tropo sends a JSON-enoded string to your web server's URL. The following is an example of how to process that JSON file and write the contents to a file.

This code creates one text file per transcription, using the ID of the transcription as the filename, and putting the transcription result as the content of the file.

<?php
 $data = file_get_contents('php://input');
 $json = json_decode($data); 
 $file = fopen($json->result->identifier . ".txt", "w"); 
 fwrite($file, $json->result->transcription);
 fclose($file); 
 ?> 
Have more questions? Submit a request

0 Comments

Article is closed for comments.