[development] Info needed to add content to Drupal via shell/curl script

M. Fioretti mfioretti at nexaima.net
Sun Jan 4 08:39:15 UTC 2009


Greetings,

I would like to ask all Drupal developers where to find the info to do
what I describe below. I have already found almost identical questions
asked both on the support list and in the forums at drupal.org, but they
did not receive complete answers, so here I am.

I want to write a shell script which takes as input an HTML file and other
parameters (title, category, etc...) and then, using curl and the POST
method, logs into a Drupal website, adds a node with that text and
parameters, logs off and returns the complete URL assigned by drupal to
that page.

The information I need is:

- what is the exact sequence of pages (relative URLs) that drupal presents
to users who login and then want to add a node?
- what is the complete list of POST parameters (assuming there is only one
custom category CAT_1) that drupal wants to see POSTed to each of those
pages?
- how much the two answers above depend on drupal version, or will change
in the future?

Important: I know I can look at all the http headers going back and forth
between browser and drupal, and using this approach I have *already*
written a working draft of the script myself, but I'm looking for a
better, more reliable way to do this. I found that the script won't work
consistantly, meaning that I'd have to tweak it every time if Drupal
version changes or (usign it on other sites) depending on which modules
are installed.

So, is there any official documentation which contains complete, reliable
answers to the questions above? In other words, is there a better, more
reliable and future-proof way to get those answers than studying source
code or raw http sessions by trial and error?

Thank you in advance for any feedback and happy 2009!

Marco

-- 
Help *everybody* love Free Standards and Software:
http://digifreedom.net



More information about the development mailing list