Snippets Collections
<?php
$url = "https://graph.instagram.com/me/media?access_token=IGQVJWVGM5azZApYkEwTENxQ19kbWdmS1dfeWxJcUk2VzJobF92LWE5NTdsNlV0dGFoNGw2bkRMZATh2SnFzcGVOeDJXNVNzcUoyS3pOY2taZA3BfX25sUHA3VXVHUlBTNFVGVHp1aEktOUxXbDlpV3cxeAZDZD&fields=media_url,media_type,caption,permalink";
// create curl resource
$ch = curl_init();

// set url
curl_setopt($ch, CURLOPT_URL, $url);

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// $output contains the output string
$instagramData = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch); 

$instagramData = json_decode($instagramData, true); // true = to array έστω
$instagramData = $instagramData['data'];

$tpl = 'instagramFeedTPL';
$out = '';

foreach ($instagramData as $data)
{
    if ($data['media_type'] == 'VIDEO')
    {
        $data['isVideo'] = 1;
    }
    
    $out .= $modx->getChunk($tpl, $data);
}


return $out;
curl -i -X GET "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&
  client_id={app-id}&
  client_secret={app-secret}&
  fb_exchange_token={short-lived-user-access-token}"
star

Sat Jun 19 2021 06:39:59 GMT+0000 (UTC) https://developers.facebook.com/docs/pages/access-tokens/#get-a-long-lived-user-access-token

#curl

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension