I am accessing an HTML page using server-side PHP and the page has a link to listen to an audio. The HTML looks like this:
<a href="http://audio.somesite.com/audio?lang=es&text=sometext">
<span class="audio-blue"> </span>
</a>
While processing the document, I need my server-side script to retrieve the file being referenced in the a tag above, and then serve the file to the client for streaming. I just need to get a hang of how to do the first, i.e. saving the file on the server from the HTML. Taking cue from a bunch of other questions that seemed to resemble this one, I tried this:
file_put_contents("myfile.mp3", fopen("http://audio.somesite.com/audio?lang=es&text=sometext", 'r'));
The above obviously failed. I am sure there's something very straightforward that's eluding me. Any hints?