I created a streaming music website. I added an ssl certificate which broke my audio player. I am streaming the audio as a file from a hidden place on the server. I am doing this to stop people from easily downloading the audio. The audio still plays fine with the link directly like this : audio file
This code used to work fine before I added the SSL certificate :
The playsong.php looks like this :
CLICK PLAY TO PLAY SONG <br />
<!-- play audio file but stop it from being downloadable -->
<audio controls autobuffer onplay="log_stream1()" controls List="nodownload noremoteplayback">
<!-- get the source as a file from -->
<source src="http://www.waylostreams.com/phptest/mp323.php?id=<?php echo $song_id;?>" type="audio/mp3">
</audio>
The mp323.php page that uses curl looks like this :
$sql = ('SELECT URL FROM songs WHERE id='.$id.'');
// get the result object.
$result = $mysqli->query($sql);
// Associative array
//echo $result;
$row=mysqli_fetch_assoc($result);
// get the URL from the array result
//echo $row;
$filename = ($row['URL']);
// function to stream file
function get_content($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo get_content($filename);
I added this line to my original code hoping it would help :
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Unfortunately it's not working and I am a bit stuck here!
Thanks in advance for any advice !
I tried other solutions from this thread which didn't work : enter link description here
Sean