I am running an apache2 server where I do my localhost testing (PHP 5.5), but my hosting provider has PHP 5.3. I don't know whether that is an issue, but I mention it just in case.
My problem is this:
I am seeking to note a couple of $_SERVER variables, but the filter_input()
function returns false for some reason, but only on my host server. It works fine on localhost.
Echoing verifies the expected output:
echo $_SERVER['HTTP_USER_AGENT'];
echo $_SERVER['REMOTE_ADDR'];
Returns as expected:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36
90.10.160.140 (Not the actual address)
But when I use the filter (even without a filter/options specified!), both are blank:
filter_input(INPUT_SERVER,'HTTP_USER_AGENT',FILTER_SANITIZE_ENCODED,FILTER_FLAG_STRIP_LOW);
filter_input(INPUT_SERVER,'REMOTE_ADDR',FILTER_VALIDATE_IP);
filter_input(INPUT_SERVER,'HTTP_USER_AGENT');
filter_input(INPUT_SERVER,'REMOTE_ADDR');
All of the above return an empty string/FALSE when executed on my hosting provider, yet work as expected on my localhost.
I'm guessing there is some config parameter set differently on the host. Any idea which one? Or what else might be the matter? Thanks.