0

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

Sean Wayland
  • 39
  • 1
  • 1
  • 8
  • I also tried adding : curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); – Sean Wayland Dec 20 '18 at 21:41
  • Don't try and bypass security measures, configure your system properly! – miken32 Dec 20 '18 at 21:46
  • how would I do that @miken32 ? – Sean Wayland Dec 20 '18 at 22:07
  • You click on the link I provided, look at the answer with the most votes, and do what they say. – miken32 Dec 20 '18 at 22:08
  • The problem I have with using the other threads info is that turning off SSL inside curl with verifypeer and verifyhost hasn't fixed the issue. That's mentioned in the other thread but it didn't work for me. I searched the error log on the server and also with the chrome developer tools trying to get the source of the error. I can only assume it's the SSL since when I added that the code broke. – Sean Wayland Dec 21 '18 at 20:22
  • According to godaddy's chat support I cannot get the path to the certificate. This link https://curl.haxx.se/docs/sslcerts.html suggests I can use curl_easy_setopt(curl, CURLOPT_CAPATH, capath); However I don't understand how to find the path. I can see a certificate on my server but it is in a location above public_html .. I can't see a way to link to it or find a path . – Sean Wayland Dec 21 '18 at 21:16

0 Answers0