Skip to content

Commit

Permalink
Fixed: "Undefined index: X-Ratelimit-Remaining"
Browse files Browse the repository at this point in the history
Updated: package name in composer.json
  • Loading branch information
vityachis committed Feb 20, 2019
1 parent f07b30c commit f091721
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
14 changes: 4 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "cosenary/instagram",
"name": "integready/instagram",
"type": "library",
"description": "An easy-to-use PHP Class for accessing Instagram's API.",
"keywords": ["instagram", "api"],
"homepage": "https://github.com/cosenary/Instagram-PHP-API",
"homepage": "https://github.com/integready/Instagram-PHP-API",
"license": "BSD",
"authors": [
{
Expand All @@ -18,14 +18,8 @@
},
"autoload": {
"psr-4": {
"MetzWeb\\Instagram\\": "src"
"IntegReady\\Instagram\\": "src"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
"minimum-stability": "stable"
}
22 changes: 11 additions & 11 deletions src/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function getLoginUrl($scopes = array('basic'))
{
if (is_array($scopes) && count(array_intersect($scopes, $this->_scopes)) === count($scopes)) {
return self::API_OAUTH_URL . '?client_id=' . $this->getApiKey() . '&redirect_uri=' . urlencode($this->getApiCallback()) . '&scope=' . implode('+',
$scopes) . '&response_type=code';
$scopes) . '&response_type=code';
}

throw new InstagramException("Error: getLoginUrl() - The parameter isn't an array or invalid scope permissions used.");
Expand Down Expand Up @@ -162,7 +162,7 @@ public function getUser($id = 0)
$auth = false;

if ($id === 0 && isset($this->_accesstoken)) {
$id = 'self';
$id = 'self';
$auth = true;
}

Expand Down Expand Up @@ -316,11 +316,11 @@ public function modifyRelationship($action, $user)
public function searchMedia($lat, $lng, $distance = 1000, $minTimestamp = null, $maxTimestamp = null)
{
return $this->_makeCall('media/search', false, array(
'lat' => $lat,
'lng' => $lng,
'distance' => $distance,
'lat' => $lat,
'lng' => $lng,
'distance' => $distance,
'min_timestamp' => $minTimestamp,
'max_timestamp' => $maxTimestamp
'max_timestamp' => $maxTimestamp,
));
}

Expand Down Expand Up @@ -549,11 +549,11 @@ public function pagination($obj, $limit = 0)
public function getOAuthToken($code, $token = false)
{
$apiData = array(
'grant_type' => 'authorization_code',
'client_id' => $this->getApiKey(),
'grant_type' => 'authorization_code',
'client_id' => $this->getApiKey(),
'client_secret' => $this->getApiSecret(),
'redirect_uri' => $this->getApiCallback(),
'code' => $code
'redirect_uri' => $this->getApiCallback(),
'code' => $code,
);

$result = $this->_makeOAuthCall($apiData);
Expand Down Expand Up @@ -630,7 +630,7 @@ protected function _makeCall($function, $auth = false, $params = null, $method =
$headers = $this->processHeaders($headerContent);

// get the 'X-Ratelimit-Remaining' header value
$this->_xRateLimitRemaining = $headers['X-Ratelimit-Remaining'];
$this->_xRateLimitRemaining = empty($headers['X-Ratelimit-Remaining']) ? '' : $headers['X-Ratelimit-Remaining'];

if (!$jsonData) {
throw new InstagramException('Error: _makeCall() - cURL error: ' . curl_error($ch));
Expand Down

0 comments on commit f091721

Please sign in to comment.