Skip to content

Instantly share code, notes, and snippets.

@anehkumar
Last active January 12, 2016 05:52
Show Gist options
  • Save anehkumar/527d7da72120634b8baa to your computer and use it in GitHub Desktop.
Save anehkumar/527d7da72120634b8baa to your computer and use it in GitHub Desktop.
Get Access token from Instagram using code
<?php
$handle = curl_init("https://api.instagram.com/oauth/access_token");
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, array(
"client_id" => "<your_client_id>",
"client_secret" => "<your_secret>",
"grant_type" => "authorization_code",
"redirect_uri" => "http://localhost:8080/instagram/",
"code" => "3c4e17fe802844099e24a3df4e659f6e",
));
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($handle);
curl_close($handle);
echo "<pre>";
print_r($output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment