Not so long time ago, maybe few years, I used to use a third party software in order to display a collection of photos from Instagram sharing the same #hashtag. The purpose is to add more fun to the event, so our guest can have their selfies or wefies on instagram, put a common #hashtag to it, then boom!.. their pictures are display on the event big screens or somewhere.
But few weeks back, I noticed that this service is not around anymore. Got info somewhere that Instagram already limit their API and that kind of operation is not allowed anymore.
But I was in rush to get the #hashtag display done. So I decided to have my own service for this purpose. It will be used in a single day, and our aim is to get it done at minimum cost.. or FREE. Ok I chose to have it done at no cost.
Here are the elements needed:
<?php
require __DIR__ . '/../vendor/autoload.php';
$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', '/path/to/cache/folder');
$instagram->login();
$medias = $instagram->getMediasByTag('youneverknow', 20);
$media = $medias[0];
echo "Media info:\n";
echo "Id: {$media->getId()}\n";
echo "Shortcode: {$media->getShortCode()}\n";
echo "Created at: {$media->getCreatedTime()}\n";
echo "Caption: {$media->getCaption()}\n";
echo "Number of comments: {$media->getCommentsCount()}";
echo "Number of likes: {$media->getLikesCount()}";
echo "Get link: {$media->getLink()}";
echo "High resolution image: {$media->getImageHighResolutionUrl()}";
echo "Media type (video or image): {$media->getType()}";
$account = $media->getOwner();
echo "Account info:\n";
echo "Id: {$account->getId()}\n";
echo "Username: {$account->getUsername()}\n";
echo "Full name: {$account->getFullName()}\n";
echo "Profile pic url: {$account->getProfilePicUrl()}\n";
?>
4. I could not get the above code working at first, until I commented out this line:
$instagram->login();
5. Customizing an HTML file to self refresh every 5 minutes, so It will fetch newly tagged photos as long as the event is running.
6. To make it better look, I used WOWSlider. It’s a windows standalone program, so I get it running, picked a template and have it run on some dummy photos, then configured the given code to fetch photos from Instagram.
Hi thanks for dropping by. Please share the content if you think there is someone who will appreciate it.