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


PHP Instagram::getPopularMedia方法代码示例

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


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

示例1: Instagram

<?php

require_once 'instagram.class.php';
$instagram = new Instagram('YOUR_APP_KEY');
$result = $instagram->getPopularMedia();
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Instagram - popular photos</title>
    <link href="https://vjs.zencdn.net/4.2/video-js.css" rel="stylesheet">
    <link href="assets/style.css" rel="stylesheet">
    <script src="https://vjs.zencdn.net/4.2/video.js"></script>
  </head>
  <body>
    <div class="container">
      <header class="clearfix">
        <img src="assets/instagram.png" alt="Instagram logo">
        <h1>Instagram <span>popular photos</span></h1>
      </header>
      <div class="main">
        <ul class="grid">
        <?php 
foreach ($result->data as $media) {
    $content = "<li>";
    // output media
    if ($media->type === 'video') {
        // video
开发者ID:Steadroy,项目名称:hcf-btw,代码行数:31,代码来源:popular.php

示例2: array

 * https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token
 * https://api.instagram.com/oauth/authorize/?client_id=e8d6b06f7550461e897b45b02d84c23e&redirect_uri=http://mauriciocuenca.com/qnktwit/confirm.php&response_type=code
 */
session_start();
require_once 'Instagram.php';
/**
 * Configuration params, make sure to write exactly the ones
 * instagram provide you at http://instagr.am/developer/
 */
$config = array('client_id' => 'e1d602f8517645749de38593dbf9ad25', 'client_secret' => '63dbfae2a6444956802e269384fc05cc', 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://www.HoopsMap.com/instagram/');
// Instantiate the API handler object
$instagram = new Instagram($config);
$accessToken = $instagram->getAccessToken();
$_SESSION['InstagramAccessToken'] = $accessToken;
$instagram->setAccessToken($_SESSION['InstagramAccessToken']);
$popular = $instagram->getPopularMedia();
print_r($popular);
// After getting the response, let's iterate the payload
$response = json_decode($popular, true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<title>Instagram API PHP Implementation demo // Popular Media</title>
</head>

<body>

<h1>Popular Media</h1>
开发者ID:phedlund33,项目名称:HoopsMap,代码行数:31,代码来源:index.php

示例3: dump

 $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();
 dump($popular_media);
 echo '<h1>Popular Media</h1>';
 foreach ($popular_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/>';
 }
 return 'vinkla/instagram';
开发者ID:jasonjyu,项目名称:cscie15-p4,代码行数:31,代码来源:routes.php


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