PHP code example of pgrimaud / instagram-user-feed
1. Go to this page and download the library: Download pgrimaud/instagram-user-feed 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/ */
pgrimaud / instagram-user-feed example snippets
// m picture from instagram
$url = 'https://scontent-cdt1-1.cdninstagram.com/v/t51.2885-19/s150x150/156309873_1632221153646196_1273891214497323498_n.jpg?tp=1&_nc_ht=scontent-cdt1-1.cdninstagram.com&_nc_ohc=vbxGNZrjPmUAX8CIDdC&edm=ABfd0MgBAAAA&ccb=7-4&oh=ae5811c07f0e73b945eb203cd58c2101&oe=60EDD1EE&_nc_sid=7bff83'
// define directory
$downloadDir = __DIR__ . '/../assets'; // change it
$fileName = MediaDownloadHelper::downloadMedia($url, $downloadDir);
// file was downloaded here : __DIR__ . '/../assets/v-t51.2885-19-s150x150-156309873_1632221153646196_1273891214497323498_n.jpg
use Instagram\Api;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
$cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/../cache');
$api = new Api($cachePool);
$api->login('username', 'password'); // mandatory
$profile = $api->getProfile('robertdowneyjr');
echo $profile->getUserName(); // robertdowneyjr
echo $profile->getFullName(); // Robert Downey Jr. Official
$api = new Api($cachePool);
$api->login('username', 'password');
$profile = $api->getProfile('robertdowneyjr');
print_r($profile);