Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
44 lines (40 sloc) 1.525 kb
* Instagram PHP API example usage.
* This is the entry point of your application, it will detect whether
* the user is already authenticated and will present her the login
* window in case she is not.
* If the authentication token is already stored (as a cookie in this case),
* the user will be redirected to callback.php which is basically the same
* URI callback that you must set up with Instagram as the return address
* for your application on their developers section:
* If you have any question, check for the
* latest updates
require_once 'Instagram.php';
* Configuration params, make sure to write exactly the ones
* instagram provide you at
$config = array(
'client_id' => 'e8d6b06f7550461e897b45b02d84c23e',
'client_secret' => '2357fc69da344800acef2592ef647491',
'grant_type' => 'authorization_code',
'redirect_uri' => '',
* This is how a wrong response looks like
* array(1) { ["InstagramOAuthToken"]=> string(89) "{"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."}" }
if (isset($_SESSION['InstagramAccessToken']) && !empty($_SESSION['InstagramAccessToken'])) {
header('Location: callback.php');
// Instantiate the API handler object
$instagram = new Instagram($config);
Jump to Line
Something went wrong with that request. Please try again.