0
votes

I'm developing a drupal module. I'm using only 2 hooks (hook_menu, hook_cron)

  • In hook_menu, I create a menu callback that does a certain function.

  • In hook_cron, the problem resides here. I wanna execute the path I created in hook_menu every time hook_cron runs!

How can I do that?!!!

1
u question is not detailed enough to help. If you can put your code in here and tell his in detail further maybe I can help then - Vishal Khialani
Same question as Berdirs remark in his answer (+1): Why the detour via a separate page request? Why don't you just call the menu callback directly from hook_cron? - Henrik Opel
I have a menu callback, and I wanna execute this menu callback everytime cron runs and I don't wanna use php's fopen() function. - Muhammad Reda

1 Answers

2
votes

You can use something like this.

drupal_http_request(url('your/path', array('absolute' => TRUE));

It's however not clear to me why you can't simply call an API function in your cron hook, another page request has quite an overhead.