Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.