My situation is:
code:
first line:
include('/opt/lampp/htdocs/myproject/application/controllers/myFile.php');
This script is running backgroud.
function procmsg($topic,$msg){
//do something...
//my_function() is a function in the myFile.php script
my_function(true, $userGtwy, $passwdGtwy, $node_id, $idGateway, $value, $rssi);
}
myFile.php
First lines of this script:
require(APPPATH.'/libraries/REST_Controller.php');
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
The function:
public function my_function($flag=false, $usr, $pass, $node, $gateway, $val, $freq){}
When I run my first script i get:
PHP Notice: Use of undefined constant APPPATH - assumed 'APPPATH' in /opt/lampp/htdocs/myproject/application/controllers/myFile.php on line 3
PHP Warning: require(APPPATH/libraries/REST_Controller.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/myproject/application/controllers/myFile.php on line 3
PHP Fatal error: require(): Failed opening required 'APPPATH/libraries/REST_Controller.php' (include_path='.:/usr/share/php') in /opt/lampp/htdocs/myproject/application/controllers/myFile.php on line 3
and, if i comment this line:
require(APPPATH.'/libraries/REST_Controller.php');
i get: No direct script access allowed
I need this library and I need access with my script, help me please!
I found this: Access Codeigniter functions from external script But i don't understand...
My question, can i do that? or is it impossible?