I got the following m3u8 as php variable($returned_content). Now i want to replace proxy-63.somesite.com part of all m3u8 with video2.de.secondsite.net then create a hyperlink for each resolution and place all the hyperlinks in textarea.(for each resolution hyperlink i want to place the resolution of m3u8 in bracket after hyperlink title).
could any one tell me how i can achieve this task? Thanks in advance
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=836280,CODECS="mp4a.40.2,avc1.64001f",RESOLUTION=768x432
http://proxy-63.somesite.com/sec(42341234k32jlkjk234lkwerwlk32432)/video/600/500/12345678_mp4_h264_aac_hq_2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=246440,CODECS="mp4a.40.2,avc1.42000d",RESOLUTION=320x180
http://proxy-63.somesite.com/sec(45432kjkhjkj4535lkj34543454lkj43)/video/600/500/12345678_mp4_h264_aac_ld_2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=460560,CODECS="mp4a.40.2,avc1.42001e",RESOLUTION=512x288
http://proxy-63.somesite.com/sec(dfgghdfdgd987435392429324343241k)/video/600/500/12345678_mp4_h264_aac_2.m3u8
PHP
$returned_content = get_data(''.$m3u8Url);
/* gets the data from a URL */
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$link_text .="<a href=\"../Player.php?&vidID=".$m3u8Url."&title=".$title_name."\">".$title_name."."(".".$resolution.".")"</a><br/>\n";