|
Posted by Erwin Moller on 10/13/15 11:39
Stefan Bellon wrote:
> Hi all!
>
> I want to parse the contents of an .htaccess file from within PHP. The
> contents of the .htaccess file looks like this:
>
> <Files foobar.tar.gz>
> AuthType Basic
> AuthUserFile /foobar
> AuthName "Foobar"
> <Limit GET>
> Require user FOOBAR
> </Limit>
> </Files>
>
> And so on. When I read in that file with the following code:
>
> $fd = fopen(".htaccess", 'rb');
> while (!feof($fd)) {
> $line = fgets($fd, 1024);
> echo "|".$line."|\n";
> }
> fclose($fd);
>
> Then I get empty lines for those lines containing <Files ...>,
> <Limit ...> and so on. How can I get at those lines as well?
>
> What I need to know is basically the information "which user can access
> which file?"
>
Hi,
Maybe you are in htmlcontext?
What does this produce?
$myLines = file('path/to/.htaccess');
foreach($myLines as $oneLine){
echo htmlentities($oneLine)."<br>";
}
Does that show correctly?
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|