View Single Post
  #1  
Old 05-01-2016, 03:07 AM
Kerem Kerem is offline
Junior Member
 
Join Date: May 2016
Posts: 8
Kerem is on a distinguished road
Question

[php curl] m3u8 works on localhost but nor work on server


I've got m3u8 link for oen of the radio streams by using Curl in PHP:

HTML Code:
<?php 
 $url = "http://karwan.tv/";
 function get_dataa($url) {
 $ch = curl_init();
 $timeout = 5;
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
 curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
 $data = curl_exec($ch);
 curl_close($ch);
 return $data;
}
 $variableee = get_dataa('http://karwan.tv/live/radio/radio-dewran.php');
$res = explode("\n",$variableee);
$strr = $res[12];
echo   $str  = substr( $strr,8 ,184);
?>
And I't works like a charm on localhost.
But when I upload this file to my website, the generated link will not work. When I opened the link it shows me this error on a white page:
"Forbidden."

Generated output link:
http://radio.karwan.me/karwan.tv/rad...1pbnV0ZXM9MjA=


What would be the solution for this problem?
Reply With Quote