Skip to content

Instantly share code, notes, and snippets.

@ig0r74
Created January 25, 2020 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ig0r74/f29bdf1389d9e2c14279a891b8aadb35 to your computer and use it in GitHub Desktop.
Save ig0r74/f29bdf1389d9e2c14279a891b8aadb35 to your computer and use it in GitHub Desktop.
<?php
require MODX_CORE_PATH . 'components/modinstagram/vendor/autoload.php';
use Phpfastcache\Helper\Psr16Adapter;
// If account is public you can query Instagram without auth
$instagram = \InstagramScraper\Instagram::withCredentials('user', 'password', new Psr16Adapter('Files'));
$instagram->login();
$account = $instagram->getAccount('ig0r74');
// Available fields
echo "Account info:\n";
echo "Id: {$account->getId()}\n";
echo "Username: {$account->getUsername()}\n";
echo "Full name: {$account->getFullName()}\n";
echo "Biography: {$account->getBiography()}\n";
echo "Profile picture url: {$account->getProfilePicUrl()}\n";
echo "External link: {$account->getExternalUrl()}\n";
echo "Number of published posts: {$account->getMediaCount()}\n";
echo "Number of followers: {$account->getFollowsCount()}\n";
echo "Number of follows: {$account->getFollowedByCount()}\n";
echo "Is private: {$account->isPrivate()}\n";
echo "Is verified: {$account->isVerified()}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment