Beispiel #1
0
<?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
Beispiel #2
0
 * 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>
Beispiel #3
0
 $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';