Skip to content

Instantly share code, notes, and snippets.

@strackoverflow
Created August 22, 2011 15:53
Show Gist options
  • Save strackoverflow/1162731 to your computer and use it in GitHub Desktop.
Save strackoverflow/1162731 to your computer and use it in GitHub Desktop.
Instagram Thumbnail
/* This is now available via the official instagram api. */
<?php
$url = $_GET['u'];
$r = file_get_contents($url);
$searchStr = 'meta property="og:image" content="';
$pos = strpos($r, $searchStr);
$s = substr($r, $pos + strlen($searchStr));
$img = substr($s, 0, strpos($s,'"'));
header('Location: '.$img);
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment