Run Magento Code Out Side Of The Magento



Sometimes we need to use Magento functions and classes outside of the Magento platform. Suppose you have a script to import the products and you want to run this one from outside of the Magento plateform then it is required to use the pre defined Magento classes and functions. You can do it by using the code below:
<?php 
require_once 'app/Mage.php';
umask(0);
Mage::app('default');
 
//Your Custom Code Will be here.
//load a category
$category = Mage::getModel('catalog/category')->load(10);
 
//load a product
$product = Mage::getModel('catalog/category')->load(100);
?>

Run Magento Session Into An External Site Click Here

Hope this will be helpful to someone else, Thanks and enjoy the reading.