I’m trying to get a sound file to be printed on a php page. I’m using the code below. I thought when I run this script it would have shown a sound file to download but it prints some text. What do you think I should do to fix this?
<?php
$mylanguage=$_GET["mylanguage"];
$soundtext=$_GET["soundtext"];
echo stream_get_contents("http://api.microsofttranslator.com/V2/http.svc/Speak?appId=9CF5D9435A249BB484EC6DB50FFFB94C6733DEFB&language=$mylanguage&format=audio/wav&text=$soundtext");
?>
Send the correct headers. By default, PHP sends
Content-Type: text/html. If you send something else, you have to send the headers by yourself.What kind of sound file is this?