</head> <body> <div id="wordcloud" style="width: 550px; height: 350px;margin: 0 auto"></div> <div class="container"> <header class="clearfix"> <img src="assets/instagram.png" alt="Instagram logo"> <h1>Instagram <span>popular photos</span></h1> </header> <div class="main"> <ul class="grid"> <?php $most_posts = get_most_posts($result->data, 3); $tag_count = get_tag_count($result->data, $tag); $word_cloud = convert_tag_count_to_word_array($tag_count); foreach ($result->data as $media) { $content = "<li>"; // output media if ($media->type === "video") { // video $poster = $media->images->low_resolution->url; $source = $media->videos->standard_resolution->url; $content .= "<video class=\"media video-js vjs-default-skin\" width=\"250\" height=\"250\" poster=\"{$poster}\"\n data-setup='{\"controls\":true, \"preload\": \"auto\"}'>\n <source src=\"{$source}\" type=\"video/mp4\" />\n </video>"; } else { // image $image = $media->images->low_resolution->url; $content .= "<img class=\"media\" src=\"{$image}\"/>"; } // create meta section
<?php header("content-type:application/json"); require "vendor/cosenary/instagram/src/Instagram.php"; require "radar.php"; use MetzWeb\Instagram\Instagram; ini_set("max_execution_time", 123456); $instagram = new Instagram("af797da93a514a9381d6862490944f45"); $hashtag = $_REQUEST["hashtag"]; $limit = 500; $posts = $instagram->getTagMedia($hashtag, $limit)->data; $post_left = $limit - count($posts); $min_tag_id = $posts[count($posts) - 1]->id; while ($post_left > 0) { $posts_temp = $instagram->getTagMediaCont($hashtag, $post_left, $min_tag_id)->data; $posts = merge_array_ordered($posts, $posts_temp); $post_left -= count($posts_temp); $min_tag_id = $posts_temp[count($posts_temp) - 1]->id; } $tag_count = get_tag_count($posts, $hashtag); $word_cloud = convert_tag_count_to_word_array($tag_count); $top_posts_limit = 5; $top_posts = get_most_posts($posts, $top_posts_limit); $users = get_users_post_like($posts); $top_users = get_top_users($instagram, $users); $image_video_count = get_image_video_count($posts); $time_interval = get_time_interval($posts); $result = array("word_cloud" => $word_cloud, "posts" => $posts, "top_posts" => $top_posts, "users" => $users, "top_users" => $top_users, "type_count" => $image_video_count, "time_interval" => $time_interval); echo json_encode($result); exit;