maxelcat Posted January 14, 2011 Share Posted January 14, 2011 Hi I am trying to get the structure of some folders/files on my server to create an xml "Feed" which then goes to a flash file. I keep getting the error message that I can't open the folder (it is set to 755) ERROR: Could not open folder: http://www.name/templates/bluezoo/mp3s What am I doing wrong please. Many thanks in advance Edward Here's some php: $directoryLocation="http://www.name/templates/bluezoo/mp3s"; // XML Doctype $xml = new DomDocument('1.0', 'UTF-8'); $xml->xmlStandalone = false; // XML Root element $root = $xml->createElement('mp3s'); $root = $xml->appendChild($root); // Grab a list of folders from the specified directory if ($dir = @opendir($directoryLocation)) { while (false !== ($file = readdir($dir))) { if (is_dir($directoryLocation . DIRECTORY_SEPARATOR . $file) && $file != '.' && $file != '..') { // If it is a folder, put it in the folders array $folders[] = $file; } } Link to comment https://forums.phpfreaks.com/topic/224412-cant-open-a-folder/ Share on other sites More sharing options...
maxelcat Posted January 14, 2011 Author Share Posted January 14, 2011 I have got a bit more detail on the error reported: Warning: opendir() [function.opendir]: URL file-access is disabled in the server configuration in /data01/name/public_html/templates/namemp3s/MP3List.php on line 16 Warning: opendir(http://www.bluezoo.org.uk/templates/bluezoo/mp3s) [function.opendir]: failed to open dir: no suitable wrapper could be found in /data01/name/public_html/templates/name/mp3s/MP3List.php on line 16 Link to comment https://forums.phpfreaks.com/topic/224412-cant-open-a-folder/#findComment-1159290 Share on other sites More sharing options...
AbraCadaver Posted January 14, 2011 Share Posted January 14, 2011 allow_url_fopen = Off in your php.ini so you can't open remote dirs/files by URL. If that dir is on the same server then just use: $directoryLocation = '/templates/bluezoo/mp3s'; Link to comment https://forums.phpfreaks.com/topic/224412-cant-open-a-folder/#findComment-1159402 Share on other sites More sharing options...
maxelcat Posted January 14, 2011 Author Share Posted January 14, 2011 Many thanks for your tip - working now! Link to comment https://forums.phpfreaks.com/topic/224412-cant-open-a-folder/#findComment-1159497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.