This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Instagram PHP Scraper. Get account information, photos and videos without any authorization

dev-master 2020-08-07 16:54 UTC

This package is not auto-updated.

Last update: 2021-10-15 19:58:32 UTC


This library is based on the Instagram web version. We develop it because nowadays it is hard to get an approved Instagram application. The purpose is to support every feature that the web desktop and mobile version support.


Code Example

$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password');
$account = $instagram->getAccountById(3);
echo $account->getUsername();

Some methods do not require authentication:

$instagram = new \InstagramScraper\Instagram();
$nonPrivateAccountMedias = $instagram->getMedias('kevin');
echo $nonPrivateAccountMedias[0]->getLink();

If you use authentication it is recommended to cache the user session. In this case you don't need to run the $instagram->login() method every time your program runs:

use Phpfastcache\Helper\Psr16Adapter;

$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', new Psr16Adapter('Files'));
$instagram->login(); // will use cached session if you want to force login $instagram->login(true)
$instagram->saveSession();  //DO NOT forget this in order to save the session, otherwise have no sense
$account = $instagram->getAccountById(3);
echo $account->getUsername();

Using proxy for requests:

$instagram = new \InstagramScraper\Instagram();
    'address' => '',
    'port'    => '8080',
    'tunnel'  => true,
    'timeout' => 30,
// Request with proxy
$account = $instagram->getAccount('kevin');
// Request without proxy
$account = $instagram->getAccount('kevin');


Using composer

composer.phar require raiym/instagram-php-scraper


composer require raiym/instagram-php-scraper

If you don't have composer

You can download it here.


See examples here.


Java library: