php - How to parse diffrent resolution m3u8 urls from m3u8 variable? -
i got following m3u8 php variable($returned_content). want replace proxy-63.somesite.com part of m3u8 video2.de.secondsite.net create hyperlink each resolution , place hyperlinks in textarea.(for each resolution hyperlink want place resolution of m3u8 in bracket after hyperlink title).
could 1 tell me how can achieve task? 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 data 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";
Comments
Post a Comment