OK, here is the code to use.
All you need to do is specify your Bloomsky API key at the top.
For some reason the videos do not work, however I checked other users´s sites, even ones using Wim´s script and the videos do not work... so I suspect this is some temporary problem with the BS Api, the links are ok, but when you click the link, the video doesn´t load.
I made the HTML the simplest possible, so that you can see how to use it and simply insert the code for the IMG and video into your existing code the way you like it.
<?php
$APIkey = "";
$url = "https://api.bloomsky.com/api/skydata";
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: ".$APIkey."\r\n"
)
);
$context = stream_context_create($opts);
$file = file_get_contents($url, false, $context);
$data = json_decode($file, true);
$imageURL = $data[0]['Data']['ImageURL'];
$video = $data[0]['VideoList'][0];
?>
<html>
<body>
<h1>Image</h1>
<img src="<?php echo $imageURL?>">
<h1>Video</h1>
<video style="width: 70%;margin:0 auto" controls>
<source src="<?php echo $video?>" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>