Closed

Instagram Basic Display API hook using PHP

Expand on my Instagram Basic Display API hook, using PHP, to check if token is close to expiring and fetch/store new token so it never 'expires'.

I am using Processwire's API but the set up is fairly standard.

// Instagram init

$instagramHttp = new WireHttp();

$instagramAccessToken = "???";

$instagramFields = "username,id,media_type,media_url,caption,tags,timestamp";

$instagramBase = "[login to view URL]$instagramFields&access_token=$instagramAccessToken";

// [login to view URL]$instagramAccessToken

// Instagram feed

wire()->addHookMethod('Page::instagramFeed', function($event) use($instagramHttp, $instagramBase) {

$page = $event->object;

// Get cache only if it's less than or equal to 30 minutes (1800 seconds)

$result = wire('cache')->get('instagramFeed', 1800);

if (!$result) {

$result = $instagramHttp->getJSON($instagramBase);

wire('cache')->save('instagramFeed', $result, 1800); // 30 minutes

}

$event->return = $result;

});

Deliverables

Block of code that I can use to fetch an Instagram feed and store the access token and check if the token has expired.

Skills: PHP, Software Architecture, MySQL, JavaScript, JSON

See more: basic database using php, using php interact plesk api, display video using php, instagram basic display api example, instagram basic display api pagination, instagram api php, instagram graph api, instagram basic display api swift, instagram api php example, instagram basic display api python, instagram api examples, display csv using php, parse yahoo weather api using php, using php yahoo store tags, using php extract href tags img src tags, skype api access using php, basic student information program using php, templatemonster api script using php, basic member system website using php mysql, ups api integration using php

About the Employer:
( 0 reviews ) Santa Clara, United States

Project ID: #27888003

1 freelancer is bidding on average $25 for this job

(127 Reviews)
6.0