Last active
May 26, 2017 07:17
-
-
Save cosenary/c94189237038769e026d to your computer and use it in GitHub Desktop.
Load user's public Instagram media
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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