简体   繁体   中英

Connect to online Magento from a localhost

Beside setting up a custom Magento API, is there a way to connect from a localhost webapp to an online Magento installation? More specifically, I'm looking for a setup that will allow me to write codes like

include('app/Mage.php');    // how does this work for online-offline connection??
$products = Mage::getModel('catalog/category')->load($category_id);

in a webapp running on localhost in our office.

If this is not plausible, do I need to connect to the Magento store DB directly from my application and basically write my own queries? I would certainly create a new user with read-only access for the DB, if this was the case.

No need to connect to the db the include will handle it:

require'app/Mage.php';  

if (!Mage::isInstalled()) {
    Mage::log("Application is not installed yet, please complete install wizard first.\n",null,'fiftyone_daemon.log');
    exit;
}
Mage::app('default'); 


$products = Mage::getModel('catalog/category')->load($category_id);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM