Search the Community
Showing results for tags 'instagram'.
-
Hello I have a strange issue. (or maybe not for you). In wordpress you can put instagram as iframes simply by writing the url on a separate line. That works fine. But I needed to get the url proglamaticly so I did a php code like the following <?php echo '<iframe height="1250px" width="96%" frameborder="0" scrolling="no" src="', htmlspecialchars($_GET["insta"]), '">', '</iframe>'; ?> What it does is that it takes from the url the variable insta and puts that on the page as an iframe. ex. www.myblog.com/specialpage?insta=https://instagram.com/p/8JEjgAicX7/ So this doesent work. it gives an empty iframe, but if I only write that address in a wordpress post or page it do work. However with the exact same code with /embed/ added do work. Problem is that does not show the captions and hashtags. www.myblog.com/specialpage?insta=https://instagram.com/p/8JEjgAicX7/embed/ <-- this is working I dont know if this a php-wordpress or what problem. but if you have a clue then your help is appreciated
-
I'm trying to accessing value from json api instagram. I've successed to access simple api that returns like this: { "pagination": { }, "meta": { "code": 200 }, "data": [ { "attribution": null, "tags": [ ], "type": "image", "location": null, "comments": { "count": 0, "data": [ ] }, "filter": "Normal", "created_time": "1339298544", "link": "http:\/\/instagram.com\/p\/LrZfG6sU_l\/", "likes": { "count": 0, "data": [ ] }, "images": { "low_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_7.jpg", "width": 612, "height": 612 } }, "users_in_photo": [ ], "caption": null, "user_has_liked": false, "id": "210373896496566245_180213154", "user": { "username": "realwahyuputra", "website": "", "profile_picture": "http:\/\/images.ak.instagram.com\/profiles\/profile_180213154_75sq_1359089013.jpg", "full_name": "realwahyuputra", "bio": "", "id": "180213154" } } ] } Since im trying to tricky the API to get all user media in one account, i combine API and next pagination api in one file named cache.json. Now it looks like this: { "pagination": { }, "meta": { "code": 200 }, "data": [ { "attribution": null, "tags": [ ], "type": "image", "location": null, "comments": { "count": 0, "data": [ ] }, "filter": "Normal", "created_time": "1339298544", "link": "http:\/\/instagram.com\/p\/LrZfG6sU_l\/", "likes": { "count": 0, "data": [ ] }, "images": { "low_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_7.jpg", "width": 612, "height": 612 } }, "users_in_photo": [ ], "caption": null, "user_has_liked": false, "id": "210373896496566245_180213154", "user": { "username": "realwahyuputra", "website": "", "profile_picture": "http:\/\/images.ak.instagram.com\/profiles\/profile_180213154_75sq_1359089013.jpg", "full_name": "realwahyuputra", "bio": "", "id": "180213154" } } ] } { "pagination": { }, "meta": { "code": 200 }, "data": [ { "attribution": null, "tags": [ ], "type": "image", "location": null, "comments": { "count": 0, "data": [ ] }, "filter": "Normal", "created_time": "1339298544", "link": "http:\/\/instagram.com\/p\/LrZfG6sU_l\/", "likes": { "count": 0, "data": [ ] }, "images": { "low_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_7.jpg", "width": 612, "height": 612 } }, "users_in_photo": [ ], "caption": null, "user_has_liked": false, "id": "210373896496566245_180213154", "user": { "username": "realwahyuputra", "website": "", "profile_picture": "http:\/\/images.ak.instagram.com\/profiles\/profile_180213154_75sq_1359089013.jpg", "full_name": "realwahyuputra", "bio": "", "id": "180213154" } } ] } { "pagination": { }, "meta": { "code": 200 }, "data": [ { "attribution": null, "tags": [ ], "type": "image", "location": null, "comments": { "count": 0, "data": [ ] }, "filter": "Normal", "created_time": "1339298544", "link": "http:\/\/instagram.com\/p\/LrZfG6sU_l\/", "likes": { "count": 0, "data": [ ] }, "images": { "low_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http:\/\/distilleryimage5.s3.amazonaws.com\/7f69259cb2ab11e1989612313815112c_7.jpg", "width": 612, "height": 612 } }, "users_in_photo": [ ], "caption": null, "user_has_liked": false, "id": "210373896496566245_180213154", "user": { "username": "realwahyuputra", "website": "", "profile_picture": "http:\/\/images.ak.instagram.com\/profiles\/profile_180213154_75sq_1359089013.jpg", "full_name": "realwahyuputra", "bio": "", "id": "180213154" } } ] } How to accessing that value in PHP? There are three data value either when the simple api just one data value. Im using this code to accessing that value but doesn't worked: $cache = './cache.json'; $response = json_decode(file_get_contents($cache),true); //Decode as an json array if(is_array($response['data'])){ foreach ($response['data'] as $data) { if ($data['comments']['data'] != null) { foreach($data['comments']['data'] as $comment){ ...
-
I am working on Instagram module Now I want like counts of the photos. For example I have account in Instagram and I want to know how many I likes the photos with my account. Is there any Instagram API thats help me regarding my quertion. Any ideas or suggestions? Thanks.
-
I am building a relatively small app in laravel. Currently I am trying to create a load more button to load more images into a container in the view. Would anyone know when clicking load more I get an internal server error? Here is my set up: View for my images: $instagram = new Instagram\Instagram; $instagram->setAccessToken($_SESSION['instagram_access_token']); $token = $_SESSION['instagram_access_token']; //$clientID = $_SESSION['client_id']; $current_user = $instagram->getCurrentUser(); $tag = $instagram->getTag('folkclothing'); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); $liked_media = $current_user->getLikedMedia(); echo '<section id="images">'; foreach ( $media as $item ) { echo '<article class="instagram-image">'; // define the form and set the action to POST to send the data to this script echo '<form class="forms" action="'; echo URL::current(); echo '" method="post">'; $id = $item->getId(); echo '<a class="fancybox" href="' . $item->link . '"><img src="' . $item->images->standard_resolution->url . '" /></a>'; if ( $current_user->likes($item) ){ echo '<button class="ajax instabtn unlike icon-heart" type="submit" name="action" value="Unlike"></button>'; } else { echo '<button class="ajax instabtn like icon-heart" type="submit" name="action" value="Like"></button>'; } echo '<input type="hidden" name="id" value="'; echo $id; echo '">'; echo '<p>'; echo $item->likes->count; echo '</p>'; //echo '<p>'.$item->getId().'</p>'; //echo '<p>By: <em>' . $item->user->username . '</em> </p>'; //echo '<p>Date: ' . date('d M Y h:i:s', $item->created_time) . '</p>'; //echo '<p>$item->comments->count . ' comment(s). ' . $item->likes->count . ' likes. '; echo '</form>'; echo '</article>'; } echo '</section>'; Here the instagram class generates the images and puts them into the div through a loop. Below is a load more button storing the data need in it. Load more button: echo "<br><button id=\"more\" data-maxid=\"{$media->getNextMaxTagId()}\" data-tag=\"{$tag}\">Load more ...</button>"; And then there is an ajax view that stores the relevant data for the images to be found for the next page: <?php // set up autoloader function app_autoloader($class) { include './' . $class . '.php'; } spl_autoload_register('app_autoloader'); // Initialize class for public requests $instagram = new Instagram\Instagram; // Receive AJAX request and create call object $tag = $_GET['tag']; $clientID = $instagram->getApiKey(); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); $call = new stdClass; $call->next_max_id = $maxID; $call->next_url = "https://api.instagram.com/v1/tags/{$tag}/media/recent?client_id={$clientID}&max_tag_id={$media->getNextMaxTagId()}"; // Receive new data $media = $instagram->pagination($call); // Collect everything for json output $images = array(); foreach ($media->data as $data) { $images[] = $data->images->standard_resolution->url; } echo json_encode(array( 'next_id' => $media->getNextMaxTagId, 'images' => $images )); This page finds the tag and gets the media for that tag and finds the next_max_id. In my jquery I use and ajax call to get this data and load the images into my div but instead I get an internal server error like so: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://client:8888/ajax?tag=client&max_tag_id=1374869525975&_=137571153802 Does anyone have an idea why it would not produce the results? I know its not too far off. Thanks, Mark ajax.blade.php image.blade.php