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


PHP Instagram::getRecentMedia方法代码示例

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


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

示例1: Instagram

  </div>
</header>
<div class="row">
  <div class="col-1"></div>
  <div class="col-10">
    <div class="row">
      <?php 
//example for use of Instagram class
require "Instagram.php";
$user_name = "consumeraffairs";
$limit = 12;
$client_id = "e89f96ef8506485dab829356282bbac5";
// initialize class
$instagram = new Instagram($client_id, $user_name, $limit);
//display recent images
echo $instagram->getRecentMedia();
?>
    </div>
  </div>
  <div class="col-1"></div>

</div>
<footer class="row center">
<div class="col-3"></div>
<div class="col-6">
  <audio id="music">
    <source src="http://tahiti-it.com/CA/get_a_job.mp3" type="audio/mpeg">
     Your browser does not support the audio element.
     </audio>
  <div class="col-4"><button onClick="download()">Download code</button></div>
  <div class="col-4"><button onclick="document.getElementById('music').play()">Play</button></div>
开发者ID:solalh,项目名称:Instagram_API_PHP,代码行数:31,代码来源:index.php

示例2: Instagram

  <div class="col-1"></div>
  <div class="col-10">
    <div class="row">
      <?php 
require "Instagram.php";
//Seting the user/client information in variable
$user_id = "647463488";
$user_name = "consumeraffairs";
$limit = 12;
$client_id = "e89f96ef8506485dab829356282bbac5";
$endpoint = "https://api.instagram.com/v1/";
//Creation of a new class dedicated to Instagram
$instagram = new Instagram($client_id, $endpoint);
try {
    //Calling the Instagram class methode that will set up the url and call the API
    $media = $instagram->getRecentMedia($user_name, $limit);
    //looping with for each to get the Pictures
    foreach ($media as $medium) {
        echo "<div class='col-2'><img src='{$medium->images->thumbnail->url}'/></div>";
    }
    //var_dump($media);
} catch (Exception $e) {
    die($e->getMessage());
}
?>
    </div>
  </div>
  <div class="col-1"></div>

</div>
<footer class="row center">
开发者ID:solalcode,项目名称:Instagram_API_PHP,代码行数:31,代码来源:index.php


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