galen / php-instagram-api Goto Github PK
View Code? Open in Web Editor NEWPHP 5.3+ wrapper for the Instagram API
PHP 5.3+ wrapper for the Instagram API
Fatal error: Class 'Instagram\Instagram' not found...
Composer's autoload_namespaces is generating:
'Instagram' => $vendorDir . '/php-instagram-api/php-instagram-api/Instagram',
and should instead read:
'Instagram' => $vendorDir . '/php-instagram-api/php-instagram-api/.',
You shouldn't use real data in your tests because it depends on their existence in database which you are not going to test. In InstagramTest.php you test a lot of functions using access_token (which is of course now expired) and that mean you test Instagram too, which is not your business. What if Instagram is down for a moment or real data you use doesn't exists any more (like access_token) and run your tests? Your tests will fail but it is not because your code is wrong.
Instead of that, tests should deal with mock objects and tests only your code separated from third parties because, in this case, we expect that Instagram API works well. That is not our business, we want to take care about our code only.
Notice: Undefined variable: auth_config in /Volumes/B/Dropbox/i.local/examples/_auth.php on line 7
Notice: Use of undefined constant EXAMPLES_DIR - assumed 'EXAMPLES_DIR' in /Volumes/B/Dropbox/i.local/examples/_auth.php on line 19
Warning: require(EXAMPLES_DIR/views/_header.php): failed to open stream: No such file or directory in /Volumes/B/Dropbox/i.local/examples/_auth.php on line 19
Fatal error: require(): Failed opening required 'EXAMPLES_DIR/views/_header.php' (include_path='.:/usr/local/Cellar/php54/5.4.15/lib/php') in /Volumes/B/Dropbox/i.local/examples/_auth.php on line 19
I began getting comments from users of our web app (http://instaglimpse.com), that things were randomly not working. After some research, I realized that there was an exception being thrown in the AUTH part of the app, but the exception is simply "Unknown Error" — I came here to see if there were any updates and then tried to use your example site (http://galengrover.com/projects/instagram/) and encountered the same issue:
I thought I'd open an issue here and see if anyone else has been encountering this random issue. Again, it happens every several requests. It has not been predictable.
Hi galen,
First, thanks a bunch for this library. I'm finding myself using it every once in a while through Composer and it's really nice.
I'm currently back working on a project I left aside for a couple of weeks, and found out my code using your library isn't working anymore :
$i = new Instagram\Instagram();
$i->setClientID('myclientid');
$test = $i->getTag('mytag')->getMedia()->getData();
This ends up with an "ApiException: Problem (2) in the Chunked-Encoded data". This exact same snippet used to work like a charm a couple weeks ago as I said ; I update my project's dependencies (including your library) through Composer on a regular basis, so I assume it's related to some change that occured in the meantime. Of course, I've tried various tags (no weird characters included, it's all [a-z]+) for the same result.
I can also tell you I already used your library on a previous project that went live before I start encountering this issue (which means I don't update its dependencies anymore), and it's still working, so I'm really positive this is caused by some recent change.
Could you please look into this ?
Regards,
Hi,
I feel kind of stupid asking but I guess is worse not to leaner, I have installed the package on larvel and it seems to work fine but all data is protected , Ive try doing things like
$this->instagram = new Instagram\Instagram( $this->token );
$raw_data = $this->instagram->getTagMedia( $tag , array('count' => '100') );
$this->instagram->setData($raw_data);
but still Im not able to do
json_encode( $this->instagram->getData() );
since everything is coming back as protected...
Im I missing something? what would be the right way to access the data?
Thanks for any help
Kept giving me this error for practically every file required. Had to solve it like this in Instagram.php
namespace Instagram;
require_once 'Core/BaseObjectAbstract.php';
require_once 'Core/Proxy.php';
require_once 'Net/ClientInterface.php';
require_once 'Net/CurlClient.php';
require_once 'Collection/CollectionAbstract.php';
require_once 'Collection/MediaCollection.php';
require_once 'Collection/TagMediaCollection.php';
require_once 'Net/ApiResponse.php';
require_once 'Media.php';
use \Instagram\Collection\MediaSearchCollection;
use \Instagram\Collection\TagCollection;
use \Instagram\Collection\TagMediaCollection;
....
Fatal error: Class 'Instagram\Core\Proxy' not found in C:\xampp\htdocs\Insta\Auth.php on line 54
Auth.php on line 54:
$this->proxy = new \Instagram\Core\Proxy( $client ? $client : new \Instagram\Net\CurlClient );
I hope someone help me with that, I try to solve it for 5 hours!
I have create index.php, and this the code inside:
'*deleted*', 'client_secret' => '*deleted*', 'redirect_uri' => '*deleted*', 'scope' => array( 'likes', 'comments', 'relationships' ) ); $auth = new Instagram\Auth( $auth_config ); if (isset($_GET['code']) && !empty($_GET['code'])){ $_SESSION['instagram_access_token'] = $auth->getAccessToken( $_GET['code'] ); echo 'ok'; }else{ $auth->authorize(); } ``` ?>Hey Galen,
I have got your Instagram PHP class working okay in my Laravel app.
I wondered how hard it would be to have a load more button in the site with images, say load more images obviously sticking to the Instagram amount every time so 20 loaded through the pagination->next_max_id. I have seen an example of it here https://gist.github.com/cosenary/2961185.
I just wondered how easy it would be with your PHP Library?
Cheers
try to load current user page, get 500 error, logs says:
PHP Fatal error: Class '\Instagram\Media' not found in path-to-folder/Instagram/Collection/CollectionAbstract.php on line 124, referer: my-domain/Examples/
looks like some server settings wrong, but don't know which one...
server PHP Version 5.3.2-1ubuntu4.18
How to get the previous page? I see only Instagram\Collection\MediaCollection::getNext() method.
#1 No where in the Instagram system is there an APP_KEY.
You have a client_id, but by asking for a KEY vs and ID, you completely throw people off.
#2 ../ makes you go backwards a directory. git clone imports to PHP-Instagram-API, so if a party goes backward, that won't work either. So your require statement is broke.
#3 using composer? you can't, nobody knows the project name to use. Your instructions completely fail here too.
{
"require": {
"cosenary/Instagram-PHP-API": "2.2.*"
}
}
produces:
Problem 1
- The requested package cosenary/instagram-php-api could not be found in any version, there may be a typo in the package name.
#4
Something went wrong :(
I have no clue what this is supposed to mean. zero error handling. Your guess is as good as mine. Anywhere you put a var_dump(), you can't get to the output.
your software is broken because your instructions are so poor.
How to use user class? you haven't describe that.
when will this be available in packagist?
Can you please tag a version so we don't need to use dev-master which may have BC breaks?
Hello,
I have downloaded the api, and upload the files at my server.
I opened Instaphp.php with my browser, and have the following error:
Parse error: syntax error, unexpected '[' in Instaphp.php on line 53
Is that a problem in the api script? I have nothing edited, only uploaded the files.
The code on Instaphp.php line 53:
private static $endpoints = [];
REST commands fail. Because curl set opt mising nvalid header: X-Insta-Forwarded-For.
Hello
I don't really know how the Pull Request system works (and I made strong modifications) so I prefer use the Issues thread
I think the few modifications of my last commit could be added to the trunk
https://github.com/mistic100/PHP-Instagram-API/commit/a76db992b9ddf62c1d4916abea65fa06c1490646
especially the cache system
Mistic
Anybody know the methods to create / list / delete subscriptions?
Or is it not available in this package?
When I call
$instagram = new Instagram;
$instagram->setAccessToken('xxx');
$tag = $instagram->getTag('MyTäg');
$media = $tag->getMedia([]);
an Instagram\Core\ApiException
is thrown with message 'Unknown Error'. When I remove the 'ä', it works fine. I have tried utf8_decode
and iconv
, but they have not helped.
The special characters get converted to something like MyT\xC3\xA4g which, of course, does not work in the URL https://api.instagram.com/v1/tags/<TAG>/media/recent
For the record, here is a deprecation warning : 'next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead'.
I just saw an issue with the library. That there problem to create objects of classes because the code is here are like java. And I am unable to use your library.
error are showing like this
Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/mytestse/public_html/instagram/Instagram/Auth.php on line 52
Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/mytestse/public_html/instagram/Instagram/Auth.php on line 52
Parse error: syntax error, unexpected T_STRING, expecting '&' or T_VARIABLE in /home/mytestse/public_html/instagram/Instagram/Auth.php on line 52
Thanks
Vishnu Dutt
Is there any way of checking if access token is valid?
Would love something like this: $instagram->isAccessTokenValid($access_token);
Right now I am in a situation where I cannot get accesstoken through oauth2 and if the access token for some reason is not valid, then I get the exceptions thrown.
Hey,
Can We able to post the image into the instagram?
I need to get Auth from the User to get the Access Token and then use that Access token to post image at instagram with same user's profile.
Can you please help me?
Would be great if it will be some stable release tagged in this repo (branch or tag).
I'm afraid of using "master" in composer.json
Hello, I don't want to use "composer.json" file. Is it possible to implement the codes without the "composer.json" file.
Regards.
I'm unable to access a tag (e.g. #fun) without having to redirect the user to the Authentication page - even though the tags method doesn't need this
API returns a deprecated warning when not specifying the parameters :
Called :
$tag = $instagram->getTag( 'nofilter' ); print_r($tag->getMedia());
Result :
Object@
(
[pagination:protected] => stdClass Object
(
[deprecation_warning] => next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead
)
[data:protected] => Array
(
)
[position:protected] =>
)
Hey guys!
I'm trying to make an Instagram auth site.
register(); $auth_config = array( 'client_id' => 'dcbcbdb34ab04f108cb83942d13e5659', 'client_secret' => 'b6584624ed90408c8da3f9d6317a24b0', 'redirect_uri' => 'http://mypapr.com/instagram_callback.php', 'scope' => array( 'likes', 'comments', 'relationships' ) ``` ); ``` $auth = new Instagram\Auth($auth_config); echo($auth->getAccessToken($_GET['code'])); ``` /\* mysql_query("INSERT INTO `$email` VALUES ('instagram_access_token', '$access_token')"); */ ``` } else { } ``` } This is my code ^. When it runs I get this error: Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/mypapr/public_html/instagram_callback.php on line 31 Parse error: syntax error, unexpected T_STRING in /home/mypapr/public_html/instagram_callback.php on line 31 I'm completely lost as to how those backslashes even function... Can I get an explanation?A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.