'3.0', 'cvid' => 'urn:bbc:pips:pid:...'] $url = MEDIASELECTOR_BASE; $options['format'] = 'json'; foreach ($options as $k => $v) { $url .= "/$k/$v"; } return json_decode(file_get_contents($url)); } function mediaselector_findHls(string $vpid): ?string { $resp = mediaselector_lookup([ 'version' => '3.0', 'proto' => 'https', 'transferformat' => 'hls', 'mediaset' => 'pc', 'cvid' => "urn:bbc:pips:pid:$vpid", ]); if (isset($resp->result) && $resp->result == 'selectionunavailable') { return null; } return $resp->media[0]->connection[0]->href; }