0

It's possible to create a cron that trigger the submission of a form ? To be clearer, when my drupal cron is executed, this form will be submitted automaticlly ?

EDIT :

This is an explantion for what reson is the cron :

Im using apachesolr for indexing articles in my website, some times it happen that some editors in the site delete articles, but the problem, these articles still exist in apachesolr... and when solr try to index again, the hole website crashes !!

so that's why I need to find out these deleted articles and delete them from solr indexing also... this module do exactly what I need : apachesolr_integrity

this module add a new submission button in apachesolr configuration page : /admin/config/search/apachesolr to Delete orphaned nodes..

But I don't need every time the site crashes, I click on this form button, maybe the site administrator is not available that time, and the site still breaking :(

I thought about cron to do this this, and also if it can be made with rules, it will be a better solution because with rules I will tell system to directly delete Orphaned nodes when a content has been deleted, and with a cron, the site can still crashed until the next cron execution..

Anyway, the question is how can I add the code made by this module in either a cron or a rule.

Thanks in advance

1 Answer 1

1

This seems a little bit odd. Form submission are meant to be dealt with by humans in order to transfer information to a specific service.

So if you want to send any kind of request to a dedicated service, yes, that is possible using drupal_http_request.

This is a flexible and powerful HTTP client implementation. Correctly handles GET, POST, PUT or any other HTTP requests. Handles redirects.

If you want to submit a Drupal form on cron, then you can use drupal_form_submit.

This function allows you to supply values for form elements and submit a form for processing. Compare to drupal_get_form(), which also builds and processes a form, but does not allow you to supply values.

If you want to execute any custom logic (which might also be the result of a form submission by humans) then this is also possible using custom code.

For all that, you will need to implement hook_cron() in a custom module.

If anything else, please elaborate on what it is that you want to achieve.

1
  • thank you for your reply, I edited the post, so you can understand now for what I need this :) Commented Feb 5, 2014 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.