Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

instagram-php-scraper

> 开发工具
Open source

Get account information, photos, videos, stories and comments.

3.3K stars0 likes0 views
WebsiteGitHub

About

Get account information, photos, videos, stories and comments.

Instagram PHP Scraper

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.

Dependencies

  • PHP >= 7.2
  • PSR-16
  • PSR-18

Code Example

use Phpfastcache\Helper\Psr16Adapter;

$instagram = \InstagramScraper\Instagram::withCredentials(new \GuzzleHttp\Client(), 'username', 'password', new Psr16Adapter('Files'));
$instagram->login();
$account = $instagram->getAccountById(3);
echo $account->getUsername();

Some methods do not require authentication:

$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client());
$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(new \GuzzleHttp\Client(), '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:

// https://docs.guzzlephp.org/en/stable/request-options.html#proxy
$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client(['proxy' => 'tcp://localhost:8125']));
// Request with proxy
$account = $instagram->getAccount('kevin');
\InstagramScraper\Instagram::setHttpClient(new \GuzzleHttp\Client());
// Request without proxy
$account = $instagram->getAccount('kevin');

Installation

Using composer

composer.phar require raiym/instagram-php-scraper phpfastcache/phpfastcache

or

composer require raiym/instagram-php-scraper phpfastcache/phpfastcache

If you don't have composer

You can download it here.

Examples

See examples here.

Other

Java library: https://github.com/postaddictme/instagram-java-scraper

GitHub Issues· 62 open

View all on GitHub
  • #1124

    Can you please help me

    Updated Jun 13, 2026
  • #1134

    ACCOUNT_JSON_INFO = 'https://www.instagram.com/{username}/?__a=1&__d=dis' no longer working

    Updated Nov 6, 2025
  • #1145

    pip install requests

    Updated Nov 2, 2025
  • #1144

    python check_usernames.py usernames.txt

    Updated Nov 2, 2025
  • #1143

    [AVAILABLE] qxj6 [TAKEN] zqk2 (status 200) [AVAILABLE] jqk3 ...

    Updated Nov 2, 2025
  • #1142

    (https://www.instagram.com/USERNAME/)

    Updated Nov 2, 2025
  • #1141

    ฉันไม่สามารถ หาเจอได้

    Updated Oct 6, 2025
  • #1121

    Undefined array key "Set-Cookie"

    Updated Aug 6, 2024
  • #1135

    Getting 403 Forbidden for logged in scrapping

    Updated Jun 5, 2024
  • #1119

    Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException

    Updated Apr 3, 2024

Highlights

  • •PHP
  • •instagram
  • •instagram-api
  • •instagram-client
  • •instagram-php-scraper

> Tags

PHPinstagraminstagram-apiinstagram-clientinstagram-php-scraper

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具