PHP:file_get_contents行为不同

I use file_get_contents to activate something on the server side. The simple call of

$content = file_get_contents('http://10.155.0.2/dir/somepage.html');

should do it. It works fine if I call the script that contains this line in the browser, but it doesn't if I call it on the command line. And I don't know why. In both cases I get the same content. At least I'm quite sure about this, but I have only very rare chances to check this. I know this could be bad to get helpful answers.

But I can reduce the problem to the following:

In one case the script is executed by the apache user in the other case I executed as root on the command line. The activation works with the apache user, with the root user it doesn't. Simple question now:

Can the different execution of the script (cli/root vs. browser/apache) containing file_get_contents influence this call anyhow?

Does it influence the headers of file_get_contents? Is there a way to check this?