I need to get some pictures which have a specific hashtag using PHP ? Any help will be awesome, or hint ?
Hashtag pages have an Instagram Story icon in the top left corner. Click on it and you'll see a collection of Stories posts tagged with the hashtag from people with public profiles.
Let's get started, first you will need to register your application on the Instagram dev site and obtain your Client ID. Set the callback url to localhost or whatever(not important, you will see why below). Now let's obtain the access token. Grant the application access to your images and press OK.
The Hashtag Search API consists of the following nodes and edges: GET /ig_hashtag_search — to get a specific hashtag's node ID. GET /{ig-hashtag-id} — to get data about a hashtag. GET /{ig-hashtag-id}/top_media — to get the most popular photos and videos that have a specific hashtag.
Instagram app for Android and iPhoneTap at the bottom to go to Search & Explore. Tap Search in the search bar at the top. Type the location name, then tap the search button in the bottom right of your keyboard. Tap Places below the search bar to see a list of locations that match your search.
Here's another example I wrote a while ago:
<?php // Get class for Instagram // More examples here: https://github.com/cosenary/Instagram-PHP-API require_once 'instagram.class.php'; // Initialize class with client_id // Register at http://instagram.com/developer/ and replace client_id with your own $instagram = new Instagram('CLIENT_ID_HERE'); // Set keyword for #hashtag $tag = 'KEYWORD HERE'; // Get latest photos according to #hashtag keyword $media = $instagram->getTagMedia($tag); // Set number of photos to show $limit = 5; // Set height and width for photos $size = '100'; // Show results // Using for loop will cause error if there are less photos than the limit foreach(array_slice($media->data, 0, $limit) as $data) { // Show photo echo '<p><img src="'.$data->images->thumbnail->url.'" height="'.$size.'" width="'.$size.'" alt="SOME TEXT HERE"></p>'; } ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With