Suljettu

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.

Taidot: PHP, Tietojärjestelmäarkkitehtuuri, MySQL, JavaScript, JSON

Näytä lisää: 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

Tietoa työnantajasta:
( 0 arvostelua ) Santa Clara, United States

Projektin tunnus: #27888003

1 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_23% %project_currencyDetails_sign_sub_24% tähän työhön

(127 arvostelua)
6.0