当前位置: 首页>>代码示例>>PHP>>正文


PHP Instagram::getTagMedia方法代码示例

本文整理汇总了PHP中Instagram::getTagMedia方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::getTagMedia方法的具体用法?PHP Instagram::getTagMedia怎么用?PHP Instagram::getTagMedia使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Instagram的用法示例。


在下文中一共展示了Instagram::getTagMedia方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smamo_instagram

function smamo_instagram()
{
    // Klargør svar
    $response = array();
    $num = isset($_POST['num']) ? 4 * wp_strip_all_tags($_POST['num']) : 4;
    // vi skal bruge et hashtag, ellers die();
    if (!isset($_POST['hash'])) {
        $response['code'] = '400';
        $response['error'] = 'No hashtag received';
        wp_die(json_encode($response));
    }
    // Indstil $tag
    $tag = wp_strip_all_tags($_POST['hash']);
    // Inkluder instagram class
    require get_template_directory() . '/functions/instagram/instagram.class.php';
    // Opret ny instance
    $instagram = new Instagram(array('apiKey' => 'dd36cc7a7be445c8a00d9f383e49f8c8', 'apiSecret' => 'e750735ffba74f8a8ed753a33c7351da', 'apiCallback' => 'http://faaborg-gym.dk'));
    $response['images'] = array();
    $inst_obj = $instagram->getTagMedia($tag, $num);
    $next_page = $instagram->pagination($inst_obj);
    $response['next'] = $next_page;
    foreach ($inst_obj->data as $key => $val) {
        $response['images'][] = $val;
    }
    wp_die(json_encode($response));
}
开发者ID:JeppeSigaard,项目名称:faaborggym,代码行数:26,代码来源:ajax-instagram.php

示例2: InstaTagMedia

 public function InstaTagMedia($tag = false, $num = false, $shuffle = true)
 {
     $instagram = new Instagram(array('apiKey' => $this->InstagramApiKey, 'apiSecret' => $this->InstagramApiSecret, 'apiCallback' => $this->InstagramApiCallback));
     $media = false;
     $output = false;
     $out = array();
     if (!$tag) {
         $tag = $this->InstagramSearchTerm;
     }
     if (!$num) {
         $num = $this->InstagramItemsCount;
     }
     try {
         $media = $instagram->getTagMedia($tag, 50);
     } catch (Exception $e) {
         SS_Log::log(new Exception(print_r($e, true)), SS_Log::ERR);
     }
     if (is_object($media) && isset($media->data)) {
         foreach ($media->data as $data) {
             if (is_object($data)) {
                 $item = array('caption' => $data->caption ? $data->caption->text : "", 'thumb' => $data->images->thumbnail->url, 'image' => $data->images->standard_resolution->url, 'username' => $data->user->username);
                 array_push($out, $item);
             }
         }
         if ($shuffle) {
             shuffle($out);
         }
         $output = ArrayList::create($out);
         $output = $output->limit($num);
     }
     return $output;
 }
开发者ID:jelicanin,项目名称:silverstripe-instagram-page,代码行数:32,代码来源:InstagramPage.php

示例3:

<?php

$items = Instagram::getTagMedia($region['greeklish'], 20);
if (count($items->data) == 0) {
    $items = Instagram::getTagMedia('greece', 20);
}
$i = 0;
?>

<div id="carouselFull" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner">

    	@foreach ($items->data as $image)
    		<div class="item {{( $i >= 1) ? '': 'active'}}" style="height: 340px;">
	            <img src="{{ $image->images->standard_resolution->url }}" width="614.5" height="368" alt="First slide">
	            <div class="container">
	                <div class="carousel-caption">
	                    
	                </div>
	            </div>
	        </div>
	        <?php 
$i++;
?>
		@endforeach
    </div>
    <a class="left carousel-control" href="#carouselFull" role="button" data-slide="prev"><span class="fa fa-chevron-left"></span></a>
    <a class="right carousel-control" href="#carouselFull" role="button" data-slide="next"><span class="fa fa-chevron-right"></span></a>
</div>
开发者ID:leloulight,项目名称:holidays-on-village,代码行数:29,代码来源:carousel.blade.php

示例4: json_encode

<?php

// Get class for Instagram
// More examples here: https://github.com/cosenary/Instagram-PHP-API
require_once 'lib/instagram.class.php';
// Initialize class with client_id
// Register at http://instagram.com/developer/ and replace client_id with your own
$instagram = new Instagram(array('apiKey' => '6ffb1036a193401ca901270833b0b905', 'apiSecret' => 'c6c9139856ab474ba1c8d74fe97b7b10', 'apiCallback' => 'http://localhost'));
// Set keyword for #hashtag
$tag = 'kisschoice';
// 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';
echo json_encode($media->data);
/*
    // 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>';
    }*/
开发者ID:popy1970,项目名称:hashtager,代码行数:25,代码来源:instagramScript.php

示例5: while

 $sql .= " ORDER BY created_at desc";
 $sql .= " LIMIT 1";
 $since_id = '0';
 $stmt = $DBH->prepare($sql);
 $stmt->execute();
 if ($stmt->rowCount() > 0) {
     while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
         $since_id = (int) $row->post_id;
     }
 }
 echo "\n\n" . SITE_TITLE . " Instagram EXTRACT \n\n";
 $totalcount = 0;
 //foreach ($terms as $term) {
 // Instagram object
 $instagram = new Instagram(IG_CLIENT_ID);
 $result = $instagram->getTagMedia(TERM1, $since_id);
 // $count = 0;
 // cycle through data
 foreach ($result->data as $media) {
     $not_valid = FALSE;
     //$blocked = FALSE;
     $tags = $media->tags;
     $link = $media->link;
     $text = isset($media->caption->text) ? $Func->sanitize($media->caption->text) : '';
     $created_at = date('Y-m-d H:i:s', $media->created_time);
     $created_date = date('Y-m-d', $media->created_time);
     $created_time = date('H:i:s', $media->created_time);
     $screen_name = $Func->sanitize($media->user->username);
     $post_id = $Func->sanitize($media->id);
     $user_id = $Func->sanitize($media->user->id);
     if (!in_array(TERM2, $tags)) {
开发者ID:hackjob83,项目名称:Social-Media-Scraper,代码行数:31,代码来源:extract_instagram.php

示例6: function

         echo '        height="480">';
         echo '</iframe>';
         // echo Twitter::linkify($tweet),
         //     '<br/><a href=',
         //     Twitter::linkTweet($tweet), '>',
         //     Carbon\Carbon::createFromFormat('D M d H:i:s P Y',
         //         $tweet->created_at),
         //     '</a><br/><br/>';
     }
     return 'thujohn/twitter';
 });
 /**
  * Registers the GET route to the vinkla/instagram package test page.
  */
 Route::get('/instagram/vinkla', function () {
     $tag_media = Instagram::getTagMedia('taylorswift', 50);
     dump($tag_media);
     echo '<h1>Tag Media</h1>';
     foreach ($tag_media->data as $media) {
         echo '<iframe class="instagram-media" ';
         echo '        src="', $media->link, 'embed/captioned/"';
         echo '        frameborder="0"';
         echo '        height="480">';
         echo '</iframe>';
         // echo $media->caption ? $media->caption->text : '',
         //     '<br/><a href=',
         //     $media->link, '>',
         //     Carbon\Carbon::createFromTimestamp($media->created_time),
         //     '</a><br/><br/>';
     }
     $popular_media = Instagram::getPopularMedia();
开发者ID:jasonjyu,项目名称:cscie15-p4,代码行数:31,代码来源:routes.php

示例7: die

error_reporting(E_ALL ^ E_NOTICE);
if (empty($_GET['tag'])) {
    die('The hashtag is required');
}
//Include Configuration
$tag = str_replace('#', '', $_GET['tag']);
$count = $_GET['count'];
if ($count == "" || $count <= 0) {
    $count = 20;
}
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);
// Get latest photos according to #hashtag keyword
$media = $instagram->getTagMedia($tag, $count);
$count = 0;
$json_format = '{"responseData": {"feed":{"feedUrl": "http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . '","title":"Instagram / ' . $tag . '","link":"http://instagram.com/tags/' . $username . '","author":"","description":"Instagram updates from ' . $tag . ' / ' . $username . '.","type":"rss20","entries":[';
if (is_array($media->data)) {
    foreach ($media->data as $row) {
        if ($count > 0) {
            $json_format .= ',';
        }
        $attached = "";
        $attached .= ' <img alt="" src="' . $row->images->standard_resolution->url . '" /> ';
        $json_format .= '{"title":' . json_encode($row->caption->text) . ',"link":"' . $row->link . '","author":"' . $row->user->username . '","publishedDate":"' . date("D, d M Y H:i:s O", $row->created_time) . '","contentSnippet":' . json_encode($row->caption->text . $attached) . ',"content":' . json_encode($row->caption->text . $attached) . ',"categories":[]}';
        $count++;
    }
}
$json_format .= ']}}, "responseDetails": null, "responseStatus": 200}';
header("Content-Type: application/json; charset=UTF-8");
开发者ID:hdpinto,项目名称:rovimat,代码行数:31,代码来源:instagram_hash.php

示例8: searchInstagram

 /**
  * Searches Instagram for the specified hashtag $term.
  *
  * @example array($insta1, $insta2, $insta3)
  * @param  string $term hashtag term to search for
  * @return array|object
  */
 protected function searchInstagram($term)
 {
     $search_results = \Instagram::getTagMedia($term, 50);
     return $search_results->data;
 }
开发者ID:jasonjyu,项目名称:cscie15-p4,代码行数:12,代码来源:SearchController.php


注:本文中的Instagram::getTagMedia方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。