how to get the root category ids from Magento
<?php
/**
* Get Magento root category ids
*/
date_default_timezone_set("Europe/London");
require './app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
Mage::getConfig()->init();
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
$ids = $tree->getCollection()->getAllIds();
$categories = array();
$rootCategories=array();
if (isset($ids)) {
foreach ($ids as $id) {
$category->load($id);
$categories[$id]['name'] = $category->getName();