[development] Curl-based content generation

M. Fioretti mfioretti at nexaima.net
Thu Feb 5 13:03:59 UTC 2009


On Thu, Feb 05, 2009 13:46:07 PM +0100, Martin Stadler wrote:
> Hi!
>
> I'm working on a small curl-based script to add content to a drupal-6  
> site. Logging-in (getting cookie etc) works fine but when I try to add  
> content I get a validation error. I guess it's about security. Is it at 
> all possible to do what I'm trying?

Martin,

possible, it's possible. I *had* made something like this work with
Drupal 4.x. Then I abandoned that project but asked here about the
best way to resurrect it just one month ago (the "Info needed to add
content to Drupal via shell/curl script"). Due to more urgent tasks I
have had to abandon that project again for the moment, but I'm still
very interested, so please keep me posted even off list if you
succeed, please. This said,

> Is there documention how these form tokens actually work and what is
> required? I couldn't find that in the formAPI docs.

this is the same problem I had, IIRC. The basic flow is simple,
conceptually. The problem is:

1) how does one know in advance what is the exact sequence of pages to
   visit, that is of Urls to pass to curl?

2) how does one know **in advance**, without going by trial and error,
   what are all the fields one should pass to curl each time, via -F?

3) how can one know **in advance** the list of admissible values for
   each field of each form (especially taxonomy terms??)?

4) can we be confident minor upgrades won't break the script, that is
   that the answers above won't change going from 6.x to 6.x+1?

5) Am I missing something else here?

As a wild, really wild guess, I **believe** that this problem you have:

> # -> does not work: response2.html says 'Validation error, please try  
> again. If this error persists, please contact the site administrator.'

may be due to point 1 above, that is you didn't call all the pages
Drupal wants you to visit, in the right order.

One part of the problem is that answers to questions 2 and 3 are
different for each site, that is they depend on which modules and node
types you have active, how many categories there are and how many
values they have, if you can upload attachments or not, etc... For me,
what would be great would be to have some simple method to know these
information via mysql. In other words, what is/are the mysql query(es)
on the server that would return a lists of all the parameters asked by
questions 2 and 3 above?

So, I have no specific answers, but I hope that this post helps us to
get them from the developers.

HTH,
		Marco
-- 
Your own civil rights and the quality of your life heavily depend on how
software is used *around* you:            http://digifreedom.net/node/84


More information about the development mailing list