'; //*************** INSTAGRAM SINGLE POSTS DATA *************** // if ($instagram_api_data) { // Define the regular expression pattern to match hashtags $pattern = '/#(\p{L}+)/u'; //print eventual errors in the API response if (isset($instagram_api_data->error)) { echo 'ERROR INFO
'; //format the error message echo 'Message: ' . $instagram_api_data->error->message . '
'; echo 'Type: ' . $instagram_api_data->error->type . '
'; echo 'Error user title: ' . $instagram_api_data->error->error_user_title . '
'; echo 'Error user message: ' . $instagram_api_data->error->error_user_msg . '
'; echo 'fbtrace_ide: ' . $instagram_api_data->error->fbtrace_id . '
'; } foreach ($instagram_api_data->data as $item) { // Process and display the data as images //print progressive number for each post starting from 1 static $counter = 1; echo 'POST NUMBER: ' . $counter++ . '
'; echo 'COVER IMAGE
'; echo '
'; echo 'MEDIA TYPE: ' . $item->media_type . '
'; echo 'ID: '.$item->id.'
'; echo 'CAPTION: ' . $item->caption . '
'; //display the array of extracted hashtags echo '
'; echo 'HASHTAGS: '; foreach (extractHashtags($item->caption) as $hashtag) { echo $hashtag . ' '; } //check if #primasquadra is in the array of extracted hashtags, if yes add a green checkmark emoji if (in_array('primasquadra', extractHashtags($item->caption))) { echo '
'; echo 'Prima Squadra ✅ '. '
'; echo 'Juniores U19 ❌ '. '
'; echo 'Settore Giovanile ❌ '. '
'; } elseif (in_array('junioresu19', extractHashtags($item->caption)) == false) { echo '
'; echo 'Prima Squadra ❌ '. '
'; echo 'Juniores U19 ✅ '. '
'; echo 'Settore Giovanile ❌ '. '
'; } elseif (in_array('settoregiovanile', extractHashtags($item->caption)) == false) { echo '
'; echo 'Prima Squadra ❌ '. '
'; echo 'Juniores U19 ❌ '. '
'; echo 'Settore Giovanile ✅ '. '
'; } echo '
'; // *************** INSTAGRAM INNER ALBUM DATA *************** // if (isset($instagram_album_data) && !empty($instagram_album_data)) { foreach ($instagram_album_data as $item_album) { if($item_album->parent_album_id == $item->id){ echo "
Parent Album ID: " . $item_album->parent_album_id . "
"; echo "Child ID: " . $item_album->id . "
"; echo "Media Type: " . $item_album->media_type . "
"; echo "Media URL: " . $item_album->media_url . "
"; echo ''; echo "
"; } } } else { echo "
No Instagram album data available.
"; } // *************** END INSTAGRAM INNER ALBUM DATA *************** // } } else { echo 'Instagram API data not available.'; } //*************** END INSTAGRAM SINGLE POSTS DATA *************** // ?>