Comments (17)
As it says at the top of that file:
Before using this, you should use examples/get_auth_token.php to retrieve an access
token and add it to examples/config.php.
i.e. the examples/config.php doesn't exist, and you have to create it.
I'll update the docs to make it more clear.
Thanks for trying it out!
from phpflickr.
Thanks!
The get_auth_token.php script also requires the config.php file:
$configFile = DIR . '/config.php';
require_once $configFile;
So I need to create the config.php file? What should I put in it? Should it be blank? What should it look like?
Thanks!
from phpflickr.
I have added some more documentation, and an example config file.
Do these make it clearer?
By the way, you might be interested in the other thing I'm using this library for at the moment: a MediaWiki extension for importing Flickr photos into a wiki. My idea is to combine it with the Cargo extension for managing lots of photos.
from phpflickr.
Thanks Sam,
I just reinstalled your code again. You write, "To use these, first copy examples/config.dist.php to examples/config.php"
There is no config.dist.php in the examples folder. Here is my listing;
Could you please provide me a text example of what the config.dist.php should look like?
Or could you please let me know where I could find a copy?
What do I need to put in the config file? I have used many config files, but generally they are provided with the code.
Also, when I finally am able to run your test scripts, which directory should they be in?
Right now the test scripts are in this folder here:
/var/www/html/gnr/vendor/samwilson/phpflickr/examples
But when I run the scripts, in which directory should I put them in?
It would be nice (and fairly easy) to have the scripts run immediately after installation, so as to save everyone time. I would love to help you with this!
Thanks!
from phpflickr.
Oh, I do apologise, I thought you were just checking out this repository on it's own, and so would be using the master branch. The new file is not in any tagged release yet.
That said, you should not need to use the examples' config file in your own project. They're there just as hints to get you going with your own code — your project will have its own way of saving API keys and tokens. If it were to create a config file on installation (or update) then it'd be created in your config directory, and the examples wouldn't know where that is. Also, you shouldn't be moving the example script anywhere; they should just stay where they are.
I suggest you download the master branch of PhpFlickr and experiment with it on its own to start with, before trying to incorporate it into a project. The example scripts are of no use in a project; they're just a learning aid.
from phpflickr.
Thanks Sam,
How do I download the "master branch of PhpFlickr?" Where might I find it?
I am just trying to get a simple script working via the command line or browser using PhpFlick on a Centos linux server, so I can play and learn.
What would be the quickest way to get one of your example scripts running on my Centos server, so I can see it work via a browser or the command line?
What all must I install so as to get a simple working script which uses PhpFlickr?
Thanks Sam
from phpflickr.
So, probably a rough guide is something like the following:
git clone https://github.com/samwilson/phpflickr`
cd phpflickr/examples
cp config.dist.php config.php
Then edit examples/config.php
to contain your own API key and secret (just those two for now).
At this point you should be able to run:
php unauthenticated_requests.php
Then run:
php get_auth_token.php
This will spit out the other two required variables for config.php, so you can copy and paste them there.
Now you should be able to run examples that require an authenticated request, such as
php recent_photos.php
Hope this helps!
from phpflickr.
Oh, sorry, forgot to add: after you clone the repo you need to run composer update
when in the phpflickr/
directory.
from phpflickr.
Thanks so much Sam!
Your simple steps got me up and running, and I am now able to start playing around and working with other methods from the Flickr API!
I think a lot of folks will find your simple steps to be of great use. Thanks so much!
from phpflickr.
Hello Sam,
When I try to call the method flickr.photos.getRecent, using the line
$recent = $phpFlickr->photos_getRecent();
in your recent_photos.php code, I get an error stating:
PHP Fatal error: Uncaught Error: Call to undefined method Samwilson\PhpFlickr\PhpFlickr::photos_getRecent() in /var/www/html/11/phpflickr/examples/11recent_photos.php:40
Stack trace:
#0 {main}
thrown in /var/www/html/11/phpflickr/examples/11recent_photos.php on line 40
Are all the Flickr API methods defined in your code?
If not, which methods are not defined?
Thanks!
P.S. I get a similar error if I call the method flickr.photos.getPopular with the following line of code which I added to your recent_photos.php script:
$recent = $phpFlickr->photos_getPopular();
The error reads:
PHP Fatal error: Uncaught Error: Call to undefined method Samwilson\PhpFlickr\PhpFlickr::photos_getPopular() in /var/www/html/11/phpflickr/examples/11recent_photos.php:41
Stack trace:
#0 {main}
thrown in /var/www/html/11/phpflickr/examples/11recent_photos.php on line 41
from phpflickr.
I'm not sure how you're getting that error, there is no file examples/11recent_photos.php
in PhpFlickr!
Is this a new file you're testing with? Can you post the whole code? I wonder if you're including vendor/autoload.php
? Or perhaps something else is wrong.
from phpflickr.
11recent_photos.php is the same as your code recent_photos.php, but I just added one line:
$recent = $phpFlickr->photos_getRecent();
I added it right under your line, which I commented out as follows:
//$recent = $phpFlickr->photos_getContactsPhotos();
Can you call the method
$recent = $phpFlickr->photos_getRecent();
from your recent_photos.php script?
from phpflickr.
Good find! This is a regression bug. The correct method name for that is photosGetRecent()
. I'll fix it up shortly, but will keep backwards compatibility. For now you should be able to use that.
from phpflickr.
This is fixed in current master. I'll prepare a release shortly.
from phpflickr.
Thanks Sam! It works now.
What are the best books, tutorials, and resources that would teach me more about the object-oriented PHP programming that your code uses?
Are there any tutorials about the classes and methods of the Flickr API?
Do you use the JSON structures in your code, as described here:
https://www.flickr.com/services/api/response.php.html
https://www.flickr.com/services/api/response.json.html
Thank you! Any hints as to what to study and read would be great!
from phpflickr.
Learning PHP is outside the scope of this project! ;-) But really, it's mostly a matter of finding a project that you wished existed and building it. All the things you need to know, you'll learn. :)
(Anyway, I'm calling this bug done for now; it's fixed in 4.3.0.)
from phpflickr.
I'm somewhat puzzled as to why recent_photos.php is being used as an example with authentication. The 2 calls used are flickr.photos.getRecent and flickr.people.getInfo and both of those do not require authentication according to the spec:
https://www.flickr.com/services/api/flickr.photos.getRecent.html
https://www.flickr.com/services/api/flickr.people.getInfo.html
Also, I've tried running this with bogus token/secrettoken and this appears to work. Unless I'm missing something?
from phpflickr.
Related Issues (20)
- Not Getting "oauth_verifier" From $flickr->getAuthUrl($perm, $callbackUrl); HOT 7
- New 6K display size support HOT 4
- Fatal error when trying to run get_auth_token.php in examples HOT 5
- Remove non-PSR6 caching
- Remove all deprecated methods in PhpFlickr HOT 2
- Switch from Travis to Github Actions HOT 1
- Add all missing API methods
- Too few arguments to function Samwilson\PhpFlickr\PhotosApi::search() HOT 2
- Session auth broken HOT 4
- dependency issue upgrading to Symfony 6.2 HOT 7
- Fix Phan suppressions
- delete returns oauth_problem=verifier_invalid HOT 3
- Add User Agent HOT 6
- Drop unsupported dependencies HOT 1
- ideas for next version: error handling and return types
- Allow User-Agent to be set in the constructor
- Help with web-based authentication HOT 2
- flickr-bundle for Symfony developers
- upload not setting privacy HOT 1
- Use live.staticflickr.com rather than farm*.staticflickr.com
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpflickr.