Moved code from test.php to fetch_meta.php