I created a service via the Service module on Drupal 7 that allow registration on the website. Trying it i get a message saying that captcha has not been filled. I send with my request all the required data like name, or password, or email, but i cannot send captcha for obvious reasons. Now, the simpler solution is to disable captcha on my website but i don't really want to do it for it must be enabled for the normal 'human' registration.
So, there's a way to disable captcha for a request coming from a web service? Or whatever else is the correct way to do it, for i don't really know how to correctly use web services, so i guess i'm doing some conceptual error...
You can use hook_form_alter() to remove the captcha elements from your form(s). For example, in a custom Drupal module try this:
<?php
function my_module_form_alter(&$form, &$form_state, $form_id) {
//dpm($form);
// Disable captcha on Services user register form.
if ($form_id == 'user_register_form') {
if (arg(0) == 'my_services_endpoint_path') {
unset($form['captcha']);
}
}
}
?>
Use the devel module's dpm()
function to inspect the form structure and find the name of the element. The example above work's for the captcha module. If you're using Mollom, I think you can just use unset($form['mollom']);