PHP code example of orsif / instagram-without-api

1. Go to this page and download the library: Download orsif/instagram-without-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

orsif / instagram-without-api example snippets




nstagramWithoutApi\Fetch;

$cookie = 'mid=YYcwjgAL....8765"';              // <!-- gent from your browser console (7)
$xIgAppId = '9366197...';                       // <!-- mages or "top" images; "recent" is by default 
  "base64images" => true,                   // <!-- optional, but without you will be not able to save images.. it increases the size of the json file
  "base64imagesCarousel" => false,          // <!-- optional but not recommended, it increases the size of the json file
  "base64videos" => false,                  // <!-- optional but not recommended, it increases the size of the json file

  "header" =>                                   
    'cookie: ' . $cookie . "\r\n" .
    'user-agent: ' . $userAgent . "\r\n" .
    'x-ig-app-id: ' . $xIgAppId . "\r\n" .
    '',

  "maxImages" => 4,                         // <!-- optional, 12 is the max number
  "file" => "instagram-cache-bytag.json",   // <!-- optional, instagram-cache.json is by default
  "time" => 3600,                           // <!-- optional, reload contents after 3600 seconds by default
  "pretty" => true,                         // <!-- optional, prettyfy json true/false

  "id" => "love",                           // <!-- id is ram.com/p/Cgczi6qMuh1/)

echo Fetch::fetchByIdUrl([

  "header" =>                                   
    'cookie: ' . $cookie . "\r\n" .
    'user-agent: ' . $userAgent . "\r\n" .
    'x-ig-app-id: ' . $xIgAppId . "\r\n" .
    '',

  "file" => "instagram-cache-byidurl.json",   // <!-- optional, instagram-cache-byidurl-{id}.json is by default
  "time" => 3600,                             // <!-- optional, reload contents after 3600 seconds by default
  "pretty" => true,                           // <!-- optional, prettyfy json true/false

  "id" => "Cgczi6qMuh1",                      // <!-- id is 
bash
composer install

# download the file https://github.com/orsifrancesco/instagram-without-api/blob/master/test.php
# add your cookie, user-agent and x-ig-app-id following the next step "How to get Instagram Cookie"

php test.php