PHP code example of fishmarket / instaphp

1. Go to this page and download the library: Download fishmarket/instaphp 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/ */

    

fishmarket / instaphp example snippets



Instaphp\Instaphp;

// Config
$config = array(
	'client_id' => 'YOUR_CLIENT_ID'
);

// Get an instance of the Instaphp object
$api = Instaphp::Instance(null, $config);

// Get the response for Popular media
$response = $api->Media->Popular();

$api = Instaphp::Instance('YOUR_ACCESS_TOKEN');

public $configDefaults = array(
  'version'=> 'v1',
  'endpoint'=> 'https://api.instagram.com',
  'endpoint_timeout'=> '10',
  'client_id'=> null,
  'client_secret'=> null,
  'oauth_path'=> '/oauth/authorize/?client_id={client_id}&amp;response_type=code&amp;redirect_uri={redirect_uri}',
  'oauth_token_path'=> 'oauth/access_token',
  'redirect_uri'=> '',
);
 echo $oAuthUrl