本文整理汇总了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>
示例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">