php-curl-instagram-graph
PHP cURL for feed Instagram Graph API
Script made based on the new (2020) Instagram API that requires authorization token generated via Facebook Developers.
Generate a token for your account
Follow the steps outlined here
How to use
Include the function in your theme an edit the line with your generated token
Customization and style
Optional compatible CSS style is included in the files.
The size was configured to display 6 columns of photos, edit as needed.
Notes
- It does not work if you do not generate the token and authorize the application/testers.
- The new instagram API still has several limitations.
- The total number of calls your app can make per hour is 240 times the number of users. Please note this isn't a per-user limit. Any individual user can make more than 240 calls per hour, as long as the total for all users does not exceed the app maximum.
- Its use and consumption can be monitored on developers.facebook.com
- Only the 1080px image size is supported.
- Videos are supported! But in this script the default setting opts for the video thumbnail to avoid conflicts.
- Official Graph API Instagram documentation can be found here
jQuery version
If you prefer jQuery, this script follows the same concepts and classes jQuery Ajax for feed Instagram Graph API
Attention token renewal
"Tokens are valid for 60 days and can be refreshed as long as they are at least 24 hours old but have not expired, and the app user has granted your app the instagram_graph_user_profile permission. Refreshed tokens are valid for 60 days from the date at which they are refreshed. Tokens that have not been refreshed in 60 days will expire and can no longer be refreshed." Here is the documentation
Through this excerpt above we can see that we have a problem with the "non-automatic" renewal of the tokens, we cannot let it expire at risk of inactivation. With just one curl -i -X GET request, we can renew the token, so if you can help with any automated solution, it would be great!