Skip to content

Instantly share code, notes, and snippets.

@companje
Last active December 16, 2019 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save companje/83939d9f1f22335ab77a3455e3c888d9 to your computer and use it in GitHub Desktop.
Save companje/83939d9f1f22335ab77a3455e3c888d9 to your computer and use it in GitHub Desktop.
beeldbank-redirect.php
usage: ?guid=E3951481AF0A54C18999B79BE2449EC1 of via .htaccess
<?php
$apiKey = "b29fb3e4-5302-11e6-8975-2b551e9b96f4";
$guid = strtolower($_GET["guid"]);
if (strlen($guid)!=32) die("404");
$a = substr($guid,0,8);
$b = substr($guid,8,4);
$c = substr($guid,12,4);
$d = substr($guid,16,4);
$e = substr($guid,20,12);
$guid="$a-$b-$c-$d-$e";
$url = "https://webservices.picturae.com/mediabank/media/$guid?apiKey=$apiKey";
$json = file_get_contents($url);
$json = json_decode($json);
header("Location: ".$json->media[0]->asset[0]->thumb->large);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment