I first scan directory tree and retrieve data from xml files with simplexml_load_file()
. The function work correctly, but I receive warning:
Warning: simplexml_load_file(startfolder/cyrilic) [function.simplexml-load-file]: failed to open stream: Permission denied in C:\xampp\htdocs\begin\xxx.php on line 36
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "startfolder/cyrilic" in C:\xampp\htdocs\begin\xxx.php on line 36
This warning appears, when there have changing subfolder. I set in php.ini:
allow_url_fopen = On
allow_url_include = On
The code is:
$dir = 'startfolder';
$items = glob($dir . '/*');
$table = 'book';
for ($i = 0; $i < count($items); $i++) {
if (is_dir($items[$i])) {
$add = glob($items[$i] . '/*');
$items = array_merge($items, $add);
}
}
echo "<ul id='booklist'>"."</n>";
foreach ($items as $key=>$file){
$url = $file;
$xml = simplexml_load_file($url);
$book_count = count($xml->book);