Cakephp function call from outside cakephp how?

Already build project and i want call some controller function to out side in webroot their directory created some php file and function which works in background .

controller function called that php files how can i do? Is it possible ?

This is not clear. You have something outside of your controller that you want the controller to be able to call? Or you have something in your controller that you want something outside of it to be able to call?

I was reading it to mean

external-program --> calls --> cake-application

1 Like

Yeah, but also “call some controller function to out side”, so I’m not 100%. And the answers to each are obviously very different.

1 Like

Yes, your right dreamingmind, Zuluru I want something like that.

So i create my function like REST API and call from outside but i got an error CSRF token mismatch so how can i resolve this problem. What should i do now Please tell me. is that wrong flow. i don’t want disable CSRF token.

I tried on testing that call on postman and i got error csrf token mismatch

So this is an entirely standard access of a controller function through your web server, and it works if you disable CSRF? That’s not at all what your original question implied. More specifics would probably help us to understand.

My cake app. live so i want some background cron jobs so i need some function defined in my controller which get me reqired data for my cron job so i want implement the such functionality .
So make my function REST function for accessing that data for that cron job. but i got error in CSRF token mismatch .

Okay. So, the short answer is that’s the wrong way to do it. :slight_smile:

What you should do is to move that function into the model, and use that function from both the controller and your cron job.

Ok thanks I am implemented that code and check it.