I can successfully import remote content using the Feeds module by manually clicking on the Import button. I need to execute the import process from code, either from a module or executing PHP code from the Rules module.
I have tried the following code in a custom module.
function imports_cron_cron(){
drupal_set_message('Import-CRON responding to cron execution! ...');
$importer_id = 'publications_import';
$url = "http://xml/url";
$feeds_source = feeds_source($importer_id);
$feeds_config = $feeds_source->getConfigFor($feeds_source->importer->fetcher);
$feeds_config['source'] = $url;
$feeds_source->setConfigFor($feeds_source->importer->fetcher, $feeds_config);
$feeds_source->save();
$feeds_source->startImport();
drupal_set_message(' .... ENDING IMPORTS-CRON CALL!');
}
Both the drupal_set_message()
calls are successfully executed, but no node is imported.
Can anyone help, please?