function instagran_feeds_fn($user)
{
    //SECRET: f7a23d3958c6421cb59fe1326f7527d8
    //CLIENTE-ID: f09df43a57a547deaa1d1873dfa3c7d8
    $CLIENT_ID = 'f09df43a57a547deaa1d1873dfa3c7d8';
    $CLIENT_SECRET = 'f7a23d3958c6421cb59fe1326f7527d8';
    require_once 'instagram.class.php';
    // initialize client
    try {
        $instagram = new Instagram($CLIENT_ID);
        // get and display popular images
        $user = $instagram->searchUser($user);
        // search for user's photos
        $media = $instagram->getUserMedia($user->data[0]->id);
        if (count($media->data) > 0) {
            foreach ($media->data as $item) {
                echo '<li>
                                <a target="_target" href="' . $item->link . '"><img src="' . $item->images->thumbnail->url . '" /></a>';
                //echo 'By: <em>' . $item->user->username . '</em> <br/>';
                //echo 'Date: ' . date ('d M Y h:i:s', $item->created_time) . '<br/>';
                //echo $item->comments->count . ' comment(s). ' .
                //$item->likes->count . ' likes. </li>';
            }
        }
    } catch (Exception $e) {
        echo 'ERROR: ' . $e->getMessage() . print_r($client);
        exit;
    }
}
function search_users()
{
    $options = get_option('si_options');
    $auth = get_option('si_oauth');
    $user = $_POST['user'];
    $config = array('apiKey' => $options['instagram_app_id'], 'apiSecret' => $options['instagram_app_secret'], 'apiCallback' => site_url() . '/wp-admin/admin-ajax.php?action=register_instagram');
    $instagram = new Instagram($config);
    $instagram->setAccessToken($auth);
    $feed = $instagram->searchUser($user, 20);
    foreach ($feed->data as $result) {
        ?>
		<div class="si_sr">
			<div class="si_sr_user_image">
				<img src="<?php 
        echo $result->profile_picture;
        ?>
">
			</div>
			<div class="si_sr_user_info">
				<div class="si_sr_user_name">
					<strong>username: </strong><?php 
        echo $result->username;
        ?>
				</div>
				<div class="si_sr_user_id">
					<strong>user ID: </strong><?php 
        echo $result->id;
        ?>
				</div>
			</div>
		</div>
	<?php 
    }
    exit;
}
Exemple #3
0
error_reporting(E_ALL ^ E_NOTICE);
if (empty($_GET['username'])) {
    die('The username is required');
}
$username = $_GET['username'];
$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);
// Set keyword for #hashtag
$user = $item_id;
$userid = $instagram->searchUser($username);
$counter = 0;
if (is_array($userid->data)) {
    foreach ($userid->data as $key => $value) {
        if ($value->username == $username) {
            $userid_filter = $userid->data[$counter]->id;
        }
        $counter++;
    }
}
// Get latest photos according to #hashtag keyword
$media = $instagram->getUserMedia($userid_filter, $count);
$count = 0;
$json_format = '{"responseData": {"feed":{"feedUrl": "http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . '","title":"Instagram / ' . $username . '","link":"http://twitter.com/' . $username . '","author":"","description":"Twitter updates from ' . $username . ' / ' . $username . '.","type":"rss20","entries":[';
if (is_array($media->data)) {
    foreach ($media->data as $row) {
Exemple #4
0
     */
    public function setSignedHeader($signedHeader)
    {
        $this->_signedheader = $signedHeader;
    }
}
$conf = array('apiKey' => 'e55f12fa633f403784037ba7dc72e684', 'apiSecret' => '1247122a9f0d46dd9c4ba84d96d5d030', 'apiCallback' => 'http://localhost/instagram');
$ig = new Instagram($conf);
$scopes = array('basic', 'likes', 'comments', 'relationships');
?>
<a href="<?php 
echo $ig->getLoginUrl($scopes);
?>
">Login</a>
<?php 
$users = $ig->searchUser('maanmughal87', 1);
echo '<pre>users:';
print_r($users);
$code = $_GET['code'];
$data = $ig->getOAuthToken($code);
echo '<pre>';
print_r($data);
// set user access token
$ig->setAccessToken($data);
// get all user likes
$likes = $ig->getUserLikes();
// take a look at the API response
echo '<pre>likes';
print_r($likes);
echo '<pre>';
// get all user likes