First post here and its a question, bommer.
Well I need to have a system do a remote insert on a database, every X action the system would do this insert. Since the implementation could change we decided to host the actual function that does the insert in a remote server, and the client system would fetch this function and use it.
My approach was to fetch the code into a variable, create the function there with create_function and then just use it, it does work except for the parameters passed to the new function are not being taken into account by the code in the function.
So, there are inserts in the database, but with empty values.
Here is how I am building the function in the client system:
Code: Select all
// remPath is defined elsewhere
$remFile = $this->readRemoteFile($remPath);
// now $remFile has the code in the form of not-a-function but using variables
// now I create the function
$doRemLog = create_function('$thisIp, $license, $currUrl, $comment, $isAttempt',$remFile);
// as you can see there are several variables, that are used in the code for the function in $remFile
// this is probably where I am wrong
// then I know the code is being executed properly because in the code for the function
// there is a check for the parameters to see if they are empty, this check is working
// on this line (me trying to call the function)
$doRemLog($thisIp,$license,$currUrl,$comment,"1");Could any of you wise guys help me debug this?
in short, the function is being created and it works, the parameters used in the function are always being used as empty.
I did check, and they are not empty.
Thank you!