In previous tutorial I have explained how to Get Instagram Access Token Using Client-Side Authentication. Now In this tutorial I will show you how to get self Instagram user ID.
Get self Instagram User ID:
Click Here to receive Instagram Access Token. Now using this token, you can get self basic details like username, profile pic, bio, etc by following URL:
https://api.instagram.com/v1/users/self/?access_token=your_access_token
I have created a function getSelfInstaID() to get self instagram user id using access token.
function getSelfInstaID(){ $token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $url = "https://api.instagram.com/v1/users/self/?access_token=".$token; Â Â Â $get = file_get_contents($url); Â Â Â $user = json_decode($get); Â Â Â if($user->data){ Â Â Â Â Â Â return $user->data->id; Â Â Â } Â Â Â return '00000000'; // return this if nothing is found }
Hope this tutorial will help you to get self instagram user id.