I'm creating a social media feed for my website that requires pulling image urls, description text, like count, hashtags, etc. I have created an instagram developer account but whenever I try and run the code to obtain a user id i get a blank response:
<?php
$json = file_get_contents("https://api.instagram.com/v1/users/search?q=$user_name&client_id=$client_id&access_token=$access_token");
var_dump($json);
$data = json_decode($json, true);
var_dump($data);
Response:
array (size=2)
'data' =>
array (size=0)
empty
'meta' =>
array (size=1)
'code' => int 200
My client is still in sandbox mode if that makes any difference.
I'm trying to get the user id of a username that is not the same as the developer account i'm using so i can get the information i need to create my feed. The commands I am trying to use are:
https://api.instagram.com/v1/users/$userId/media/recent/?access_token=$token
EDIT: Fixed the code above, the command can also be pasted in the URL bar