Ok, I am adding another answer to help you with your revision. I'd like to note that your question is explain backwards. You should start with the main file (index.php). I will explain it this way for more clarity.
Your index.php file at the server root has this:
<?php
include "folder/folder/test.php";
?>
So, we can go ahead and replace the include with the contents of "test.php" and then work from there. That means index.php now looks like this:
<?php
$im = file_get_contents("im.txt");
?>
I feel almost certain that this is where you are lost. The file at your server root is now running that above code. Witch means it is looking for (server-root)/im.txt. But you have said that it is found at (server-root)/folder/folder/im.txt. So, change that line in "test.php" to that directory, like this: $im = file_get_contents("folder/folder/im.txt");
Now, index.php will pull in test.php's code, then look for "im.txt" in the appropriate folder at which point, index.php will look like this:
<?php
$im = '88-88-88';
?>
As I said, there are many ways to deal with the relative links to make them more dynamic, in case you want to include a file in different directories and change what it is relative to. You can even make it relative to "test.php" if you want to. Research php's magic constant DIR , FILE and function called getcwd()
, Those should help you do more advanced things. For now, you could just fix it by adjusting the directory manually.
Further reading:
http://yagudaev.com/posts/resolving-php-relative-path-problem/
Get the current script file name