Free PHP Script To Connect To Instagram API
Last week we helped a client get their Instagram feed back up and running on their website. On some of their web pages they pulled in recent posts from their feed, images of their store, happy customers, recent creations, that sort of thing. This functionality failed once Instagram updated their API's.
So I wrote a PHP script that could get things back on track. No database is needed. No weird libraries, classes or methods. Just a bit of straight PHP code to help you out.
How It Works
- To use the script, grab it from Github. See below.
- Load it to your web server so that it can be accessed in a web browser.
- Update the variables at the top of the script so that it points to your Instagram account and knows where to save cached data in your file system.
- Hit the script in a web browser. Login to Instagram when prompted and allow the script to access your feed.
- The script will process the short-lived and long-lived access token processes. It will cache your feed and end by returning Instagram's JSON version of your feed.
- Every time a web browser hits the script, a fresh daily copy of the feed will be returned and the appropriate token will be refreshed.
Where Is This Script!!??
This free PHP script is available from Solspace's Github account here: