rss Block
Select a Blog Page to create an RSS feed link. Learn more.
', true); $html = substr($html, 0, -1); $html = '{' . $html; // for debugging... sigh........ // echo $html; $data = json_decode($html); // more debugging... // print_r($data->entry_data->ProfilePage[0]->user->media->nodes); if (isset($_GET['user'])) { if ($data->entry_data->ProfilePage[0]->user->media->nodes) { $nodes = $data->entry_data->ProfilePage[0]->user->media->nodes; } else { exit('Looks like this Instagram account is set to private or doesn\'t exist. We can\'t do much about that now, can we?'); } } if (isset($_GET['hashtag'])) { $nodes = $data->entry_data->TagPage[0]->tag->media->nodes; } header('Content-Type: text/xml; charset=utf-8'); $rss_feed = ''; if (isset($_GET['user'])) { $rss_feed .= ''.$_GET['user'].'\'s Instagram Feedhttp://instagram.com/'.$_GET['user'].''.$_GET['user'].'\'s Instagram Feed'; } if (isset($_GET['hashtag'])) { $rss_feed .= 'Photos tagged with: '.$_GET['hashtag'].' on Instagramhttp://instagram.com/explore/tags/'.$_GET['hashtag'].'Photos tagged with: '.$_GET['hashtag'].' on Instagram'; } foreach($nodes as $node) { $rss_feed .= ''; if(isset($node->caption) && $node->caption != '') { $rss_feed .= htmlspecialchars($node->caption, ENT_QUOTES); } else { $rss_feed .= 'photo'; } // pubdate format could also be: "D, d M Y H:i:s T" $rss_feed .= 'https://instagram.com/p/'.$node->code.'/'.date("r", $node->date).''; if (isset($_GET['user'])) { $rss_feed .= ''; } $rss_feed .= 'display_src.'" />]]>https://instagram.com/p/'.$node->code.'/'; } // foreach "node" (photo) $rss_feed .= ''; echo $rss_feed; ?>