Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #3 from bobey/master

getUserFeedMethod have optional parameters
  • Loading branch information...
commit c8e51b780f009429737fc9dcd9872068c0480c93 2 parents b83e23d + ba7714a
macuenca authored

Showing 1 changed file with 14 additions and 7 deletions. Show diff stats Hide diff stats

  1. +14 7 Instagram.php
21 Instagram.php
@@ -35,7 +35,7 @@ class Instagram {
35 35 'authorize' => 'https://api.instagram.com/oauth/authorize/?client_id=%s&redirect_uri=%s&response_type=%s',
36 36 'access_token' => 'https://api.instagram.com/oauth/access_token',
37 37 'user' => 'https://api.instagram.com/v1/users/%d/?access_token=%s',
38   - 'user_feed' => 'https://api.instagram.com/v1/users/self/feed?access_token=%s&max_id=%d&min_id=%d',
  38 + 'user_feed' => 'https://api.instagram.com/v1/users/self/feed?%s',
39 39 'user_recent' => 'https://api.instagram.com/v1/users/%d/media/recent/?access_token=%s&max_id=%d&min_id=%d&max_timestamp=%d&min_timestamp=%d',
40 40 'user_search' => 'https://api.instagram.com/v1/users/search?q=%s&access_token=%s',
41 41 'user_follows' => 'https://api.instagram.com/v1/users/%d/follows?access_token=%s',
@@ -201,13 +201,20 @@ public function setAccessToken($accessToken) {
201 201 * @return string
202 202 */
203 203 public function openAuthorizationUrl() {
204   - $authorizationUrl = sprintf($this->_endpointUrls['authorize'],
  204 + header('Location: ' . $this->getAuthorizationUrl());
  205 + exit(1);
  206 + }
  207 +
  208 + /**
  209 + * Generate Instagram credentials verification page URL.
  210 + * Usefull for creating a link to the Instagram authentification page.
  211 + * @return string
  212 + */
  213 + public function getAuthorizationUrl() {
  214 + return sprintf($this->_endpointUrls['authorize'],
205 215 $this->_config['client_id'],
206 216 $this->_config['redirect_uri'],
207 217 self::RESPONSE_CODE_PARAM);
208   -
209   - header('Location: ' . $authorizationUrl);
210   - exit(1);
211 218 }
212 219
213 220 /**
@@ -225,8 +232,8 @@ public function getUser($id) {
225 232 * @param integer $maxId. Return media after this maxId.
226 233 * @param integer $minId. Return media before this minId.
227 234 */
228   - public function getUserFeed($maxId = null, $minId = null) {
229   - $endpointUrl = sprintf($this->_endpointUrls['user_feed'], $this->getAccessToken(), $maxId, $minId);
  235 + public function getUserFeed($maxId = null, $minId = null, $count = null) {
  236 + $endpointUrl = sprintf($this->_endpointUrls['user_feed'], http_build_query(array('access_token' => $this->getAccessToken(), 'max_id' => $maxId, 'min_id' => $minId, 'count' => $count)));
230 237 $this->_initHttpClient($endpointUrl);
231 238 return $this->_getHttpClientResponse();
232 239 }

0 comments on commit c8e51b7

Please sign in to comment.
Something went wrong with that request. Please try again.