<?php require "vendor/cosenary/instagram/src/Instagram.php"; require "radar.php"; use MetzWeb\Instagram\Instagram; ini_set("max_execution_time", 123456); $instagram = new Instagram("af797da93a514a9381d6862490944f45"); $tag = "video"; // Set number of photos to show $limit = 10; $result = $instagram->getTagMedia($tag, $limit); // Users $users = get_users_post_like($result->data); echo "Users (" . sizeof($users) . ")<br>"; echo "Username Posts Likes<br>"; foreach ($users as $user) { echo $user["user_id"] . "--" . $user["username"] . "--" . $user["post_num"] . "--" . $user["like_num"] . "<br>"; } echo "<br><br>Top Users<br>"; // Search user with most posts and likes $top_users = get_top_users($instagram, $users); $max_post_idx = $top_users["max_post_idx"]; $max_like_idx = $top_users["max_like_idx"]; $max_post = $users[$max_post_idx]["post_num"]; $max_like = $users[$max_like_idx]["like_num"]; $max_post_username = $users[$max_post_idx]["username"]; $max_like_username = $users[$max_like_idx]["username"]; echo "Most posts: " . $max_post . " posts by " . $max_post_username . "<br>"; echo "Most likes: " . $max_like . " likes by " . $max_like_username . "<br><br><br>"; // Activities Volume $image_type_count = 0;
<?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;