Open tunage opened 9 years ago
copy/paste of your sample code just explodes
Notice: Undefined property: stdClass::$user in /usr/local/www/apache24/data/success.php on line 21
Notice: Trying to get property of non-object in /usr/local/www/apache24/data/success.php on line 21
Notice: Undefined property: stdClass::$access_token in /usr/local/www/apache24/data/vendor/cosenary/instagram/src/Instagram.php on line 526
Fatal error: Uncaught exception 'Exception' with message 'Error: _makeCall() | users/self/media/recent - This method requires an authenticated users access token.' in /usr/local/www/apache24/data/vendor/cosenary/instagram/src/Instagram.php:441 Stack trace: #0 /usr/local/www/apache24/data/vendor/cosenary/instagram/src/Instagram.php(158): MetzWeb\Instagram\Instagram->_makeCall('users/self/medi...', true, Array) #1 /usr/local/www/apache24/data/success.php(27): MetzWeb\Instagram\Instagram->getUserMedia() #2 {main} thrown in /usr/local/www/apache24/data/vendor/cosenary/instagram/src/Instagram.php on line 441
your instructions fail to mention that you need to require 'vendor/autoload.php'; in order to find the classes.
Your test code fails because there is no 'code' being returned.
How do I get any part of your code to function?
<?php session_start(); require 'vendor/autoload.php'; use MetzWeb\Instagram\Instagram;
$instagram = new Instagram(array( 'apiKey' => 'aaa', 'apiSecret' => ' bbb', 'apiCallback' => 'success.php' ));
echo "Login with Instagram"; var_dump($instagram); $code = $_GET['code'];
$data = $instagram->getOAuthToken($code);
echo 'Your username is: ' . $data->user->username; ?>
[\u@vultr:/usr/local/www/apache24/data] # php success.php Login with Instagramobject(MetzWeb\Instagram\Instagram)#2 (7) { ["_apikey":"MetzWeb\Instagram\Instagram":private]=> string(32) "aaa" ["_apisecret":"MetzWeb\Instagram\Instagram":private]=> string(33) "bbb" ["_callbackurl":"MetzWeb\Instagram\Instagram":private]=> string(11) "success.php" ["_accesstoken":"MetzWeb\Instagram\Instagram":private]=> NULL ["_signedheader":"MetzWeb\Instagram\Instagram":private]=> bool(false) ["_scopes":"MetzWeb\Instagram\Instagram":private]=> array(4) { [0]=> string(5) "basic" [1]=> string(5) "likes" [2]=> string(8) "comments" [3]=> string(13) "relationships" } ["_actions":"MetzWeb\Instagram\Instagram":private]=> array(6) { [0]=> string(6) "follow" [1]=> string(8) "unfollow" [2]=> string(5) "block" [3]=> string(7) "unblock" [4]=> string(7) "approve" [5]=> string(4) "deny" } } PHP Notice: Undefined index: code in /usr/local/www/apache24/data/success.php on line 14
Notice: Undefined index: code in /usr/local/www/apache24/data/success.php on line 14 PHP Notice: Undefined property: stdClass::$user in /usr/local/www/apache24/data/success.php on line 18
Notice: Undefined property: stdClass::$user in /usr/local/www/apache24/data/success.php on line 18 PHP Notice: Trying to get property of non-object in /usr/local/www/apache24/data/success.php on line 18
Notice: Trying to get property of non-object in /usr/local/www/apache24/data/success.php on line 18 Your username is: