<?php

// fetch the category if we have the product object

// record the category info for this product
$category = array();
$cat_ids = $_product->getCategoryIds();
$cat = new Mage_Catalog_Model_Category();
foreach ($cat_ids as $cid)
{
    $cat->load($cid);
    // var_export($cat);

    $cat_data = $cat->_data;
    $category[] = array(
        'name' => $cat_data['name'],
        'url_key' => $cat_data['url_key']
        );
}