:< '-.__/ '._,} \_/ / ()) // | >:< `'---. ____'-.|(`"` // \ >:< \\_\\_\ | ; // \ \\-{}-\/ \ // \ '._\\' /) // '. /( // `-._ _____ _ _____ __.'\ \ // / \ / \ / \ \ \ // jgs _.'/^\'._.'/^\'._.'/^\'.__) \ // ,==' `---` '---' '---' ) // `"""""""""""""""""""""""""""""""` require 'akamai_token_v2.php'; function getStreamURL($product, $secure=true, $staging=false) { $akamaiKey = '[CHANGEME]'; $products = [ 'stream_packaging' => [ 'host' => 'sport1_24x7_free-lh.akamaihd.net', 'host_staging' => 'sport1_24x7_free-lh.akamaihd-staging.net', 'host_custom' => 'sport1_24x7_free-lh.streaming.sport1.de', 'path' => '/i/24x7_SPORT1_FREE_1@324937/master.m3u8', ], 'hls' => [ 'host' => 'sport1free-i.akamaihd.net', 'host_staging' => 'sport1free-i.akamaihd-staging.net', // only works when setting the Host-header to the non-staging one 'path' => '/hls/live/252861/24x7_Sport1_Free/master.m3u8', ], 'vod' => [ 'host' => 'pmds.sport1.de', 'host_staging' => 'pmds.sport1.de.edgekey-staging.net', 'path' => '/p/20160825/0/0_oavju19x_0_3n77b1kf_2.mp4', ], ]; $streamUrl = sprintf('http%s://%s%s', $secure ? 's' : '', $products[$product]['host' . ($staging ? '_staging' : '')], $products[$product]['path']); if ($product === 'vod') { return $streamUrl; } $c = new Akamai_EdgeAuth_Config(); $c->set_key($akamaiKey); $c->set_acl('/*'); // $c->set_start_time(strtotime('2016-12-08T00:00:00Z')); // does not work? $c->set_window(300); $g = new Akamai_EdgeAuth_Generate(); $token = $g->generate_token($c); return $streamUrl.'?hdnts='.$token; } $url = getStreamURL($product, $secure, $staging); if ($URLonly) { die($url.PHP_EOL); } ?>