I'm working on a script written in php that will collect the number of posts there is with a certain hashtag. I've found the correct api here but it doesn't seem to work for me. I go through the authentication peace and receive an acnes-token but when i try to use it I get the error message:
{"meta":{"error_type":"OAuthAccessTokenException","code":400,"error_message":"The access_token provided is invalid."}}
This is the could of page instagram redirects the user to after authentication:
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo $code = $_GET["code"];
$content = get_data("https://api.instagram.com/v1/tags/sweden?access_token=".$code) or die("could not open stream");
echo $content;
?>
Tankfull for any help!