Hi Martin, The FormAPI generates a security token, I'm not sure if it's something in the session or returned in the form iteself (the latter I think). So you'll probably want to visit the page your form is on, grab the variables and post them back in your submission. Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 0121 288 0434 Mobile : 07951 270 026 http://www.computerminds.co.uk 2009/2/5 Martin Stadler <martin@siarp.de>:
This cannot be a general approach to add content to an arbitrary Drupal site. Your points are valid and if you need that you need to write a module providing an API or use SQL directly.
What I'm trying to do is writing a very custom one-time script to add content automatically to a certain site. So I can find out about the form details once in advance and that should be it. Yes, it may depend on what modules you have enabled and form details may change even in minor Drupal versions (security fixes i.e.). I'm aware of that and I'd adjust my script accordingly in that case.
I just want to know what I need to send to add content to the default page content type with no modifications for the latest stable Drupal 6 release.
Martin
Am 05.02.2009 um 14:03 schrieb M. Fioretti:
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