Create Simple Product programmatically in Magento1

There are some steps to create a simple product through code.
1) Firstly include the Mage.php file.
2) after that create the product model.
3) after that set type id is simple.
4) define product information like name, status, price, etc.

 require_once('app/Mage.php'); //Path to Magento
$product = Mage::getModel('catalog/product');
$product->setStoreId(1) //you can set data in store scope
    ->setWebsiteIds(array(1)) //website ID the product is assigned to, as an array
    ->setAttributeSetId(4) //ID of a attribute set named 'default'
    ->setTypeId('simple') //product type
    ->setName('Product test') //product name
	->setSku('product-test') //SKU
    ->setStatus(1) //product status (1 - enabled, 2 - disabled)
    ->setTaxClassId(0) //tax class (0 - none, 2 - taxable, 4 - shipping)
    ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) //catalog and search visibility
    ->setPrice(200.00) //price 
    ->setMetaTitle('product test meta title')
    ->setMetaKeyword('product test meta keyword')
    ->setMetaDescription('product test meta description')
    ->setDescription('product test long description')
    ->setShortDescription('product test short description')
    ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization
    ->addImageToMediaGallery('media/catalog/product/test-product.png', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery
                       'use_config_manage_stock' => 0, //'Use config settings' checkbox
                       'manage_stock'=>1, //manage stock
                       'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart
                       'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart
                       'is_in_stock' => 1, //Stock Availability
                       'qty' => 999 //qty
   ->setCategoryIds(array(2)); //assign product to categories
}catch(Exception $e){