note 94846 modified in function.file-get-contents by felipe

From: Date: Sun, 29 Nov 2009 18:38:40 +0000
Subject: note 94846 modified in function.file-get-contents by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-163380@lists.php.net to get a copy of this message
It seems that when using <?php $f = 'www.yourwebsite.com/some_directory/some_file.txt'; $f = file_get_contents($f,'r'); echo "\n\n$f\n\n"; ?> the server considers the address to be an external one even that "some_file.txt" is on the same server where the PHP file is run at In order to go around simply replace the domain name with ".." <?php $f = '../some_directory/some_file.txt'; $f = file_get_contents($f,'r'); echo "\n\n$f\n\n"; ?> --was-- It seems that when using $f = 'www.yourwebsite.com/some_directory/some_file.txt'; $f = file_get_contents($f,'r'); echo "\n\n$f\n\n"; the server considers the address to be an external one even that "some_file.txt" is on the same server where the PHP file is run at In order to go around simply replace the domain name with ".." $f = '../some_directory/some_file.txt'; $f = file_get_contents($f,'r'); echo "\n\n$f\n\n"; http://php.net/manual/en/function.file-get-contents.php

« previous php.notes (#163380) next »