LINK 1 function tamago($id) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://player.tamago.live/api/rooms/' . $id); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl, CURLOPT_TIMEOUT,5); $resp = curl_exec($curl); curl_close($curl); $resp = json_decode($resp, true); if (isset($resp['data']['stream']['original'])) return str_replace('.flv', '.m3u8', $resp['data']['stream']['original']); else return ''; } function taocachefile($id){ $cachefile = 'cache/tamago-'.$id.'.xml'; $cachetime = 3600; if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) $content = file_get_contents($cachefile); else { unlink($cachefile); $content = tamago($id); if ($content != '') file_put_contents($cachefile,$content); } return $content; } $link1 = ''; $links = array(); foreach ($idtamago as $id) { array_push($links, taocachefile($id)); } foreach ($links as $link) { if ($link != '') $link1 .= "'$link', "; } $link1 .= "'$linkbk', '$linkbk2', '$linkbk3', '$linkbk4', '$linkbk5',"; ?>
LINK 1