Is there any ready parser of html pages?

We need a parser, which would set the folder to scan and he would be brought to a separate html page with a list of all files with the extension .html
July 2nd 19 at 17:32
5 answers
July 2nd 19 at 17:34
list.php but it's not the parser. he use
 <?php foreach (glob("*.html") as $page): ?>
the <li>
 <a href="<?php echo $page ?>">
 <?php echo $page; ?>
 <?php endforeach; ?>

if under Windows it create a file of type list.cmd
@echo off

call :start > list.html

echo ^<ol^>
for %%f in (*.html) do echo ^<li^>^<a href^="%%~nxf" ^>%%~nxf^^</a></li^><a href^="%%~nxf" ^>
echo ^</a></ol > ^>
Cool works!!! under Windows used your second option. Thank you very much. - Amos_Leffl commented on July 2nd 19 at 17:37
July 2nd 19 at 17:36
find . -name "*.html" or even easier *.html. Thus we will find all .html
But the whole thing)


files=$(find . -name "*.html")
$to "" > $1
$to "" >> $1
$to "" >> $1
$to "<title>Your html files</title>" >> $1
$to "" >> $1
$to "" >> $1

for i in $files
 $to "<a href="\""$i"\"">"$i"</a>" >> $1

$to "" >> $1
$to "" >> $1

But it is in bash. However, it is unlikely to be a problem with him. On Windows there is a Linux Subsystem which has a bash. On Linux... bash there by default.
July 2nd 19 at 17:38
$path = "folder";
 $slides = glob($path."/*.{html}", GLOB_BRACE);
 if(count($slides) != 0 )
 foreach($slides as $slide)
 $path_parts = pathinfo($slide);
 $dir = $path_parts['dirname'];
 $name = $path_parts['basename'];

 echo $dir.'/'.$name.'<br/-->';
July 2nd 19 at 17:40
For a node:

var fs = require('fs');
var path = require('path');
var dir = process.cwd(); // folder is the same where the script is being run

// all files in a folder
var files = fs.readdirSync(dir); 

// filter out html files
var data of "htmlfiles" = files.filter(file => path.extname(file) === '.html');

//then do with them what you want, for example:
var stream = fs.createWriteStream('my_file.txt');
stream.once('open', fd => {
 data of "htmlfiles".forEach(fileName => {
July 2nd 19 at 17:42
Where is this folder on your server or not access to the "table of contents" (index) can be obtained, or only brute force?
I have locally can web server on the computer to deploy - Amos_Leffl commented on July 2nd 19 at 17:45
Forgot to add, the parser reads the name of the html page and simply enter them in the list li, and as a reference, the same name is used, as the html page itself - Amos_Leffl commented on July 2nd 19 at 17:48

Find more questions by tags PHP