Path (URL) to call custom module function I am developing a custom module and I need an URL that would trigger an action when called.

The purpose is for an external server to call this address passing some variables through $_REQUEST['message'], and then return a STRING with the success/error string. So the URL in question is only supposed to be called by a machine.

I now have a PHP file in the root that does the job, but I'd like to integrate it to the Drupal way through this custom module.... Is there a way to do this?

Thank you
The best way to do this is to build a custom module and implement the hook hook_menu().

You'll need to implement:


a .info file with metadata about your
module
a .module file containing
hook_menu() and your callback


foo.module should look like this:

function foo_menu() {
  $items = array();
  $items['foo/myurl'] = array( // change 'foo/myurl' to the url you want
    'title' =&gt; 'Callback',
    'type' =&gt; MENU_CALLBACK,
    'page callback' =&gt; 'custom_callback',
    'access arguments' =&gt; array('access content'),
  );
  return $items;
}

function custom_callback () {
  // Parse $_REQUEST parameters
  return 'success';
}