getMessage()} HTML; exit(1); } $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'admin'; // change this to appropriate store if needed. $params[\Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM] = true; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); // bootstrap /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication('Magento\Framework\App\Http'); // configure environment $om = $bootstrap->getObjectManager(); $areaList = $om->get('Magento\Framework\App\AreaList'); $areaCode = $areaList->getCodeByFrontName('admin'); /** @var \Magento\Framework\App\State $state */ $state = $om->get('Magento\Framework\App\State'); $state->setAreaCode($areaCode); /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */ $configLoader = $om->get('Magento\Framework\ObjectManager\ConfigLoaderInterface'); $om->configure($configLoader->load($areaCode)); // end initialize Magento environment open($targetDir . 'archive.zip'); if ($res !== true) { echo 'ERROR unpacking archive'; exit; } $zip->extractTo($targetDir); $zip->close(); // run the profile, which should be associated with final import file $om->get('\Unirgy\RapidFlow\Helper\Data')->run('Your Import Profile');