Skip to content

Instantly share code, notes, and snippets.

@cosenary cosenary/usermedia.php
Last active May 26, 2017

Embed
What would you like to do?
Load user's public Instagram media
<?php
/**
* Instagram PHP API
* Example for using the getUserMedia() method
*
* @link https://github.com/cosenary/Instagram-PHP-API
* @author Christian Metz
* @since 4.04.2014
*/
require 'Instagram.php';
use MetzWeb\Instagram\Instagram;
// initialize class
$instagram = new Instagram('YOUR_APP_KEY');
// user ID (find your ID: http://otzberg.net/iguserid)
$userID = 347792643;
// get the most recent public media published by the user
$media = $instagram->getUserMedia($userID, 8);
// display the most recent public media published by the user
foreach ($media->data as $entry) {
echo "<img src=\"{$entry->images->thumbnail->url}\">";
}
?>
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.