On Thu, Feb 5, 2009 at 3:37 PM, M. Fioretti <mfioretti@nexaima.net> wrote:
On Thu, Feb 05, 2009 13:50:46 PM -0500, Earl Dunovant wrote:
Use drupal_execute().
The only problem is that to write such a script one needs to know in advance:
- the exact sequence of URLs to call (isn't this documented anywhere but in the source code itself?) - a list of the names and admissible values of all the form variables to pass to curl when it calls each one of those URLs. (**)
You need to know the fields in the form to create the node type you want to create. You put the data in $form_state['values'], just as is passed into, hook_form_alter(). You can get that by writing a hook_form_alter() function that calls var_export($form_state['values'], 1);
Then, 1: call drupal_get+form() to get the from-defining array 2: populate your $form_state['values'} array with your new node data 3: call drupal_execute($form_id, $form, $form_state); Lather, rinse, repeat until you're done. No URLs involved. Stick it in a module and call it from your script or a menu as you prefer. Read the docs and you'll see how it's done.