composer require raiym/instagram-php-scraper
use InstagramScraper\Instagram;
$instagram = new Instagram();
$account = $instagram->getAccount('kevin');
/*
Available properties:
$username;
$followsCount;
$followedByCount;
$profilePicUrl;
$id;
$biography;
$fullName;
$mediaCount;
$isPrivate;
$externalUrl;
*/
echo $account->followedByCount;
$medias = $instagram->searchAccountsByUsername('durov');
echo '<pre>';
echo json_encode($medias);
echo '</pre><br/>';
$medias = $instagram->getMedias('kevin', 150);
/*
Available properties:
$id;
$createdTime;
$type;
$link;
$imageLowResolutionUrl;
$imageThumbnailUrl;
$imageStandardResolutionUrl;
$imageHighResolutionUrl;
$caption;
$videoLowResolutionUrl;
$videoStandardResolutionUrl;
$videoLowBandwidthUrl;
*/
echo $medias[0]->imageHighResolutionUrl;
echo $medias[0]->caption;
$media = $instagram->getMediaByCode('BDs9iwfL7XA');
$media = $instagram->getMediaByUrl('https://www.instagram.com/p/BDs9iwfL7XA/');
echo $media->owner->username;
$media = $instagram->getMediaById(1042815830884781756);
$medias = $instagram->getMediasByTag('zara', 30);
echo json_encode($medias);
$medias = $instagram->getTopMediasByTagName('durov');
echo 'CODE: ' . Media::getCodeFromId('1270593720437182847_3');
// OR
echo 'CODE: ' . Media::getCodeFromId('1270593720437182847');
// OR
echo 'CODE: ' . Media::getCodeFromId(1270593720437182847);
// CODE: BGiDkHAgBF_
// So you can do like this: instagram.com/p/BGiDkHAgBF_
echo 'Media id: ' . Media::getIdFromCode('BGiDkHAgBF_');
// Media id: 1270593720437182847