Programmatically create node using feeds I'm creating nodes from XML using the Feeds module (great module BTW).

function boardgamegeek_menu() {
  $items['games/add/%/%'] = array(
    'title' =&gt; 'Boardgamegeek add game',
    'description' =&gt; 'Boardgamegeek add game',
    'page arguments' =&gt; array(2, 3),
    'page callback' =&gt; 'boardgamegeek_add',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_NORMAL_ITEM,
  );
  return $items;
}

function boardgamegeek_add($objectid, $title) {
  $node = new stdClass();
  $node-&gt;type = 'boardgame';
  $node-&gt;title = $title;
  $node-&gt;feeds['FeedsHTTPFetcher']['source'] = 'http://www.boardgamegeek.com/xmlapi/boardgame/' . $objectid;
  node_save($node);
  /*
  // This does an import
  $myFeed = feeds_source('game_importer');
  while (FEEDS_BATCH_COMPLETE != $myFeed-&gt;import());
  */
  return 'http://www.boardgamegeek.com/xmlapi/boardgame/' . $objectid;
}


When I run this code, a node is created with a title field value from $title (that's exactly what I want). The import doesn't start automatically, and when I start the import myself, another node is being created without any title.

I would like to update the node I created...


The feed_nid and the entity_id should be the same. The feed_nid is the node id from the node I created, the entity id is the node id feeds created.

Any ideas?
From the description what I understand is that you are trying to create a node with all the contents from the feed except the Title which you have set manually. 

You have created a feed which would run when you create a node of the type "boardgame" with an HTTP Fetcher. 

The way feeds work in this case is when you create the node with the attached feed. It creates a node for the feed itself and also creates additional nodes with the contents in the feed. So in effect the feed is not meant to update the node executing the feed but to create additional nodes from the feed itself. And I guess that is happening without any issue in your setup. 

To achieve what ou want to do you can install the following module 

Feeds Self Parser

What this does it to update the node being created from the feed it self and not create another node instead. 

Note : You might have to clear cache for the module to work other wise you might get an error FeedsMissingPlugin_feeds_form in drupal_retrieve_form()

This way you dont really need to create a module just create a node with the with the title entered and the url as well. But if there is some other reason from creating the module then yes that would work fine as well. 

Second option is to not use the feeds module itself. Just parse the xml manually and add the required fields and call the node_save() function. This would mean you wouldn't have to run the feed script after you create the node it would be done automatically by just calling the url. and it will also take you off the overheads of using the feeds module.